text: #6364 ([Element].querySelectorAll Does Not Work As You Expect It) – Dojo Toolkit
  #6364 closed defect (wontfix)
  [Element].querySelectorAll Does Not Work As You Expect It
  In a follow-up to bug #5832: The querySelectorAll method doesn't behave as you expect it to when rooted against a DOM Element, observe the following example:
  <div><p id="foo"><span></span></p></div>
  <script src="http://o.aolcdn.com/dojo/1.1.0/dojo/dojo.xd.js"></script>
  alert( dojo.query('div span', foo).length ); // should return nothing
  alert( foo.querySelectorAll('div span').length ); // will return the SPAN
  You can view the demo here: ​http://ejohn.org/files/bugs/qsa-root/dojo.html
  Note: The demo doesn't have any problems in Safari 3.1 because querySelectorAll is currently disabled by [13142] (but it will have problems in a future release of Safari - and in Internet Explorer 8b1).
  I, personally, feel that this is a complete mistake in the specification and implementations of querySelectorAll - and should be rectified at the specification level. If you feel similarly please voice your concerns to the Web API Working Group, otherwise here's the bug for your future reference.
  Just to clarify: The correct result is currently returned in IE 8b1 because IE 8b1 doesn't implement Element.querySelectorAll (thus, Dojo ignores it). Assumedly, however, when it does try to implement it it will do it in a way that matches the current specification.
  Agreed. This is a spec bug, as is the inability to specify rootedness (although Maciej's ":root" proposal seems to fix that for me)
  Yeah, I'm cool with that :root recommendation as well. Alright, I'm going to keep pushing this ahead and bring it up on the mailing list.
  comment:7 Changed 11 years ago by dylan
  [email protected]… alex removed
  Yep, most agree this was a spec bug, but the ship has sailed. Dojo corrects for this bug (and so do just about every other JS library). Also, I think :scope is actually the most current recommendation for rooting.