Closed erkie closed 2 years ago
at https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier:
In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit.
So --foobar
is not a valid CSS identifier because it starts with two hyphens.
Is this project intended to be 100% spec compliant or real world compliant? If the latter I would argue it's a reason to get this fixed. (If it's worth anyone's time however, is up for debate) The reason I found this bug after 3 hours of debugging was that the test case worked in both Chrome, Firefox, node and other command line tools like pup
It's intended to work in the real world. (But note that you can rewrite your selector in a spec-compliant way as .\2d\2d foobar
)
If there's a real-world use case and somebody writes a high-quality pull request, I'll merge it.
Wow! Thanks for this everyone involved.
It looks like this is the offending line:
https://github.com/andybalholm/cascadia/blob/master/parser.go#L101
Simple test case: