This bug was originally uncovered through jQuery's selector, but the behavior is consistent with document.querySelector (the underlying selector parsing is the same). Per the CSS Working Group's spec - https://drafts.csswg.org/css-syntax/#rule-defs: > When defining a function or a block, the ending token must be specified in the grammar, but if itβs not present in the eventual token stream, it still matches. For example, the following will throw an exception in Safari: ``` document.querySelector('[data-my-target="someId"'); ``` Note the lack of a closing brace (]) in the selector. While I have my own opinions on this matter, it is inconsistent with other major browsers (Chrome and Firefox), and seems to run contrary to the working group's specification. Note: this may be an issue specifically with Safari and not Webkit. I don't have access to Webkit builds on my work computer, otherwise I'd validate that
Thanks for the report! It seems this got fixed at some point.