What about JavaScript
However, Whitworth also notes that extra diligence is required when dealing with JavaScript and dynamism in the DOM structure, If you are using JavaScript to add or replace classes on events over and over again you should think about how that will affect the overall web pipeline and the DOM structure of the box you're touching.
This ties in with the earlier comment from Paul Irish (https://www.paulirish.com/). Rapid invalidation of areas of the DOM thanks to class changes can occasionally show up complex selectors. So, maybe we should be worried about selectors?
There are exceptions to every rule and there are selectors that are more performant than others but we normally only see these in cases where there are massive DOM ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access