getElementsBySelector (slightly OT)
Firstly sorry since this isn't exactly jQuery-specific but rather
something that I think would hugely boost the performance capabilities
of all the javascript libraries.
Reading John's blog about speed comparisons using Firefox 3's new
native getElementsByClassName got me thinking. Bear with me and please
do point out if I'm missing something obvious, since I don't really
get why this hasn't been done already.
The browser has to have a native implementation to select elements by
a CSS selector, right? How else would it apply those all the CSS rules
in the first place. And with any reasonable logic that implementation
has to be a lot faster than anything javascript alone can give us. Why
isn't this capability exposed to javascript as a whole? Why are we
just gradually getting small fragments of that functionality available
to javascript (such as the upcoming getElementsByClassName in FF3)? If
we could just do (or the libraries could do for us) something like
document.getElementsBySelector('div.foo > .bar:last-child') instead of
relying on the library's (slower) method of manually walking the DOM
and finding the elements for us.
Maybe you could enlighten us a bit John, since you have some inside
intel on FF development and certainly know much more about the inner
magics of the browser than most of us.