Hacker News new | ask | show | jobs
by yenoham 5024 days ago
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.