PDA

View Full Version : New fast selector engine



mankz
20 Oct 2009, 12:54 AM
Would this be something to plug into the Ext core perhaps? Claims to be faster than sizzle and others...

http://webreflection.blogspot.com/2009/10/nwmatcher-quick-look.html

Bulle Bas
20 Oct 2009, 2:23 AM
Wow:
http://dl.getdropbox.com/u/513327/nwmatcher_match_performance.png

VinylFox
20 Oct 2009, 5:39 AM
A link directly to the library for those interested...

http://javascript.nwbox.com/NWMatcher/

or straight to the code in github...

http://github.com/dperini/nwmatcher

dperini
3 Jan 2010, 6:05 AM
NWMatcher 1.2.0 has been released, lot of improvements both on specs and on speed.

Added a third parameter to allow for passing a callback that will be executed for each element matching the passed selector, a very useful addition that avoid an extra user iteration for example when extending groups of elements.

NW.Dom.select("div", document, Element.extend);
NW.Dom.select("div", document, function(e) { e.style.border = '1px solid blue'; });

Available both on GitHub and on GoogleCode:

http://github.com/dperini/nwmatcher/downloads/
http://code.google.com/p/nwevents/

I think the "match(element, selector)" method in it is one of the most appealing features for ExtJS. Very useful in delegation to check the target of the event in a fast and efficient way (not going through all the elements). It emulates the MatchesSelector() API not yet available in browsers (only available in nightly WebKit and Firefox).

Thank you for trying and suggesting it,

Diego Perini