News for hackers. Stuff that matters.
Re:Don't use class names to find HTML elements with JS (foll... by yenoham on Friday September 14, 2012 @08:06AM (#4521201)
Accessing the DOM is always slow in relative terms. In might not be applicable to everyone, but if you're accessing the DOM for view template purposes - I'd recommend using require.js with the text plugin instead.

And in all other cases, cache the jQuery object as early as possible in your module (i.e. assign `this.$targetEl = ...` in any init function you have ... so by the time you need to actually access/move/etc. that element, its already waiting for you.

There are no comments on this comment yet.