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 trees in tandem with JavaScript anti-patterns that causes DOM thrashing and additional layout or painting to take place | ||
--Whitworth |
For more simplistic JavaScript changes, Lewis offers this advice, The solution is normally...