What should documentFragment.querySelector(":scope") return?
Since DocumentFragment is not an element, it cannot return DocumentFragment.
In the case of ShadowRoot, what should shadowRoot.querySelector(':scope > div') return?
Link to the spec section:
https://drafts.csswg.org/selectors-4/#scoping
cc @tabatkins @fantasai
No need to explicitly tag us in, we read all the issues anyway.
Your first question is "nothing" - querySelector()'s argument is a scoped selector, which only matches descendants of the scoping element.
For your second, it's defined in CSS Scoping - the shadow root is a virtual scoping root. The shadow root does have children - the elements of the shadow tree - so they're appropriately matched. If there are any top-level divs in the shadow tree, they'll be returned by that query.
Most helpful comment
No need to explicitly tag us in, we read all the issues anyway.
Your first question is "nothing" - querySelector()'s argument is a scoped selector, which only matches descendants of the scoping element.
For your second, it's defined in CSS Scoping - the shadow root is a virtual scoping root. The shadow root does have children - the elements of the shadow tree - so they're appropriately matched. If there are any top-level
divs in the shadow tree, they'll be returned by that query.