Gimme.query is slow and should be optimized


Gimme.query is often slow when retrieving elements on a page with a large and complicated DOM structure. This is because Gimme blindly queries backwards and doesn't bother to trim the tree at all.
Ex: #a #b .dog
If there is only one .dog element, Gimme will still check all elements on the page, because it works backwards: first, retrieving all elements and weeding out those that do not have the class .dog; then walking the ancestry chain to ensure that those that do have the class .dog have ancestors #b and #a.
This could be made much more efficient by first ensuring that #b and #a exist in the DOM. If not, no need to progress further. If so, we can trim the tree by only retrieving the descendants of #b and making sure than they have the class .dog (as opposed to checking all elements).
Closed Oct 16, 2007 at 8:54 PM by sstchur


sstchur wrote Oct 16, 2007 at 8:54 PM

Resolved in Caspian (v1.5)

wrote Oct 16, 2007 at 8:54 PM

wrote Feb 13, 2013 at 1:49 AM

wrote May 14, 2013 at 9:43 PM