Re: [csswg-drafts] [css-variables][css-conditional] passing lone surrogates to CSS.supports()

Per Syntax, if you specify an escape for a lone surrogate, it returns U+FFFD. CSS is defined in terms of codepoints, not any particular encoding.

Per Conditional, CSS.supports(property, val) compares the property (in a case-insensitive manner) directly to our known properties, without running CSS parsing on it. So there's no way to do a CSS escape in the string, that'll just be interpreted as an ident with those characters escaped in.

You *can* write `@supports (--\0: foo) {...}` in a stylesheet; to do the same in the JS API, you can use a *JS escape*, like `CSS.supports("--\0", "foo")` - this will *happen* to produce the same thing - a property name composed of two dashes and a null.

Whether `CSS.supports("--\ud800", ...)` is testing for two dashes followed by U+D800, or two dashes followed by U+FFFD, depends on whether `CSSOMString` is defined as DOMString or USVString.

I don't *think* it's possible to actually produce a custom property whose name contains a U+D800 character, but I'm not 100% sure - if you send it in UTF-16 with an appropriate encoding set at a higher level, I think you might be able to create a lone surrogate? Unclear. Anyway, both variants are valid custom property names per the grammar.

----------

So, nothing in this email requires action.

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

Received on Friday, 28 September 2018 22:13:33 UTC