I suppose the answer to this question depends on what browser you are using, but I guess that just makes it all the more interesting.
I'm wondering how the querySelector()
method is actually implemented. Similarly, I'm curious about querySelectorAll()
and other methods like getElementById()
and getElementByClassName()
etc.
Is it a depth first search, breadth first search, or does it utilize some auxiliary data structure, like a global hash table to act as a registry?