Writing efficient jQuery code
Let's now proceed and analyze the most important jQuery-specific performance tips. For more information about the most up-to-date performance tips on jQuery, keep an eye on the relevant page for jQuery's Learning Center: http://learn.jquery.com/performance
Minimizing DOM traversals
Since jQuery made DOM traversals so simple, many web developers overused the $()
function everywhere, even in subsequent lines of code, making their implementations slower by executing unnecessary code. One of the main reasons that the complexity of the operation is so often overlooked is the elegant and minimalistic syntax that jQuery uses. Despite the fact that JavaScript browser engines became many times faster in the last few years, ...
Get jQuery Design Patterns now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.