News for hackers. Stuff that matters.
Re:How to go faster than jQuery, Ext, Mootools...? by jie on Saturday April 02, 2011 @01:38AM (#2399304)
In my.js, elts wrappers are both cached by id and in their native HTMLElements. The performance increases are sometimes from 1 to 100. Caching FTW. In fact, caching has only 1 minor fallback: you can't change an elt id if you have already accessed it by his former id (but who does? it's such bad practice). For the above snippet, it's normal that your new h2 doesn't have any class since the $ fn only returns the first h2 (like querySelector) contrary to jQuery $ who returns a set. The 3rd line of your code only add class to your first h2. To get a set of selected elts in my.js, use "$.elts" and it will work! If you're interested, I may give a presentation on my.js at the next WebWorkerCamp in Paris!

There are no comments on this comment yet.