TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

5 jQuery performance tips

2 pointsby codepunkerover 10 years ago

1 comment

gergesimover 10 years ago
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")