|
|
|
|
|
by XLcommerce
5212 days ago
|
|
you're kidding me right? Obviously you filter your queries to the closest node. Are you testing your code on ie6 running on a 486? Even a 486 could parse out a handful of nodes from a dom sub tree in max double digit milliseconds. Those 'Frankenstein' queries are ridiculously easy to read and to type. 'massive speed losses from parsing' Nobody is searching the entire dom for matching nodes. The single biggest performance killer... far more important than tree traversal is event overhead. As long as you think long and hard before applying a new event handler (and use delegation whenever possible) you'll be fine even with those 'Frankenstein' queries hehe :P The DOM is not CSS. What does that even mean in this context?? How does it further your point? illustrates a continued ignorance of the DOM enlighten us then... |
|
I test all the way back to IE 5.5. Try browsing a site with a heavy jQuery dependency in IE 5.5 (StackOverflow is a nice example). Those sites tend to implode.
> Those 'Frankenstein' queries are ridiculously easy to read and to type.
You sure about that?
A: `$(someForm).find("input[name=whatever]")`;
B: `someForm.elements.whatever`;
B is quicker to execute, type, and read.
Try running some speed tests on `find`. You'll notice it's pretty inefficient.
> Nobody is searching the entire dom for matching nodes.
I should start counting the number of times I encounter `$(".stupid")` reading source code. The count would probably be in the thousands.
> What does that even mean in this context?? How does it further your point?
Using "CSS selectors" to traverse a tree of nodes is utterly stupid. That's what recursion/tree traversal algorithms are for. What's nice is tree traversal is rarely necessary. Selecting via `id` or `name` (through an `HTMLCollection`) is quick and easy.
> enlighten us then...
I've posted 3 comments now on this topic. Shall I link various DOM specs?