As is being discussed for v2 of the Selectors API, we should add a function to Element to check if it matches a selector (Element.webkitMatchesSelector). Mozilla is also working on this (https://bugzilla.mozilla.org/show_bug.cgi?id=518003).
Created attachment 40048 [details]
Landed in r48723.
Created attachment 40087 [details]
modified version of jressig's test
The speed improvements will be really high for this method, I would like to underline the fact that this new methods could be called thousands of time during page interactions controlled by event delegation, so it seems important
to have the fastest outcome in speed from these methods.
Here is the test showing the described slowness:
Can be tested only with r48723 and above or a nightly Firefox.
I used r49078 in my tests.