TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

5 jQuery performance tips

2 点作者 codepunker超过 10 年前

1 comment

gergesim超过 10 年前
I'd really avoid encouraging people to build up strings of html that you simply append to the DOM. This is a great way to run into XSS issues. Although the live DOM is slow,using a DocumentFragment (even if it's completely abstracted away with jQuery) is the right way to make modifications in bulk. The AJAX example is pretty convoluted so I'm not sure what you're proving, but building onto the promise chain seems like a better and much more readable code. Regarding ID selectors, querySelectorAll really minimizes the huge performance gain of id selectors only, and that's exactly what's used on any modern browser when you do a $(".foo")