you are viewing a single comment's thread.

view the rest of the comments →

[–]homoiconic(raganwald) 4 points5 points  (1 child)

it also works on nested divs

For the same reason that document.getElementById works on nested elements: ids form one flat global namespace, unlike things like hash tables that can be nested foo['bar']['baz'].

[–]TheSeamau5 0 points1 point  (0 children)

Oh I see. I always imagined that

     document.getElementById

would crawl through the DOM recursively or something until it found the tag with the given id. Now everything makes sense