|
|
|
|
|
by dmethvin
5418 days ago
|
|
It depends on the selector and the browser. Something like $(".myclass") is worth caching on IE7 because it requires a pass through the entire document; there's no `querySelectorAll` or `getElementsByClassName`. I wouldn't start by caching selectors all over the place unless you profile and see that it's slow. Doing a lot of selecting in a `scroll` or `mousemove` handler would be a bad idea though: http://ejohn.org/blog/learning-from-twitter/ |
|