> But that would mean that .querySelectorAll(":root div") would never > match anything since :root (or :scope) could only match the element > itself, which of course isn't a descendant.
I was under the impression that within the context of a DOM element :root would be equivalent to the root element itself - not the document element. Thus these two would be equivalent (returning the same sets of elements): document.getElementById("test").getElementsByTagName("div") document.getElementById("test").querySelectorAll(":root div") If that's not the case then disregard all of the previous ":root is a good solution" talk, because that's what I was basing this on. --John