jQuery-最低浏览器内存要求
我们将 jQuery 版本 1.6 用于基于 AJAX 的 Web 应用程序。我正在研究不同浏览器(主要是 IE、Firefox、Chrome 和 Safari)渲染 jQuery 支持的页面所需的最小内存。我尝试在 Google 甚至 docs.jquery.com 上搜索,但找不到任何答案。任何帮助或指示将不胜感激。
谢谢, 里迪马
We're using jQuery version 1.6 for an AJAX-based web app. I'm researching for the minimum memory required by different browsers (primarily IE, Firefox, Chrome and Safari) to render jQuery powered pages. I tried to search on Google and even docs.jquery.com but couldn't find any answer. Any help or pointers will be appreciated.
Thanks,
Ridhima
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Jquery本身的内存消耗并不是一个大问题。您只需创建一个不需要大量处理的代码,无需担心。
我使用大量 Jquery 构建了网站,即使在“旧”Android 手机中也能顺利运行。
提示:
您应该避免的事情之一是将事件分配给大量元素。我在一个项目中工作,我在一个表中有一个非常大的元素列表(超过 500 个),并且我使用如下方式分配了单击函数:
始终牢记,您的代码在其库函数中真正执行的操作。
在该片段中,我“查找”了 500 个 TR 元素中的每一个,并在每个循环中搜索某个按钮类并为其分配一个事件。该页面需要超过 5 秒(冻结)才能完全呈现。
我解决了这个问题,在每个可点击元素上手动添加“onClick=Javascript:functionName()”(在“编译时”)。
The memory consumption by Jquery itself is not a big a problem. You have just to create a code which doesn't implies a big amount of processing, and there's nothing to fear.
I have built websites using a lot of Jquery which run smoothly even in "old" android phones.
A tip:
One of the things you should avoid, is assigning events to big number of elements. I worked in a project which I had a really big list of elements(more than 500) in a table, and I assigned click functions using something like this:
Have always in mind, what your code really does inside it's libraries functions.
In that snippet, I was "foreaching" each one of my 500 TRs elements, and in each loop, searching for some button class and assigning it an event. The page was taken more than 5 seconds (frozen) to render completely.
I solved this problem adding an "onClick=Javascript:functionName()" manually(in "compile time") on each of the clickable elements.
jQuery 本身并不消耗大量内存。我有一台旧的 2.2 GHz P4 机器,具有 1 GB RAM,并且 jQuery 站点运行得很好。
jQuery itself isn't a huge memory hog. I've got an old 2.2 GHz P4 machine with 1 GB of RAM and jQuery sites run just fine.