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

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. 


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

Received on Friday, 3 November 2017 19:56:46 UTC