dom
dom copied to clipboard
Allow 'lower-boundary' scoping argument in querySelector()
The CSSWG is working on new 'scoping' functionality, that allows authors to establish both upper (root) and lower boundaries on a 'scoped' selector. The result is that selectors match within a tree fragment starting at the root, and containing all descendants up until a lower boundary selector is matched.
It would be great to have this option available for authors in querySelector() as well. In our discussions, @tabatkins suggested the following:
In particular, the current second argument to qS() is, effectively, the upper bound of scoping; we could expand the argument to be an options bag with
{upper: [nodes], lower: [nodes]}to accommodate both directions.
It currently doesn't have a second argument?
Also, https://whatwg.org/faq#adding-new-features applies here. In addition to what is stated there it would be good to know if this is a frequent issue developers face (e.g., questions on Stack Overflow) and whether libraries are addressing this problem.
It currently doesn't have a second argument?
Oh lol, I'm still remembering the original form of querySelector from a decade ago. Well, what I mean is really the context argument is the upper boundary.