Re: [csswg-drafts] [selectors] querySelector() with quote and/or square bracket missing on right (#1933)

> The example can be simplified to `document.querySelector('[n');`
> 
> As expected, the spec says it should fail:
> 
> 1. [`querySelector`](https://dom.spec.whatwg.org/#dom-parentnode-queryselector) does a [scope-match a selectors string](https://dom.spec.whatwg.org/#dom-parentnode-queryselector).
> 2. [Scope-match a selectors string](https://dom.spec.whatwg.org/#dom-parentnode-queryselector) [parses a selector](https://drafts.csswg.org/selectors-4/#parse-a-selector).
> 3. [Parse a selector](https://drafts.csswg.org/selectors-4/#parse-a-selector) parses as a [`<selector-list>`](https://drafts.csswg.org/selectors-4/#typedef-selector-list).
> 4. A `[` in a [`<selector-list>`](https://drafts.csswg.org/selectors-4/#typedef-selector-list) begins an [`<attribute-selector>`](https://drafts.csswg.org/selectors-4/#typedef-attribute-selector), which must be closed with `]`.
> 5. Therefore the string does not match the grammar, and [parse a selector](https://drafts.csswg.org/selectors-4/#parse-a-selector) returns failure.
> 6. Therefore [scope-match a selectors string](https://dom.spec.whatwg.org/#scope-match-a-selectors-string) throws a "SyntaxError" DOMException.





https://stompjs.github.io/decoration10/

-- 
GitHub Notification of comment by lestertraumatic
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1933#issuecomment-3417065199 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 17 October 2025 20:37:07 UTC