css-houdini-drafts icon indicating copy to clipboard operation
css-houdini-drafts copied to clipboard

[css-properties-values-api] PropertyDescriptor::name unnecessarily uses CSS syntax

Open SimonSapin opened this issue 8 years ago • 4 comments
trafficstars

This is pretty much the same as https://github.com/w3c/csswg-drafts/issues/1325.

https://drafts.css-houdini.org/css-properties-values-api/#register-a-custom-property

Attempt to parse name as a <custom-property-name>.

This suggests using a CSS parser to parse the contents of a JS string, with CSS backslash-escapes (in addition to any JS backslash-escapes, if the JS string was initially a literal). Instead it should only check something like "starts with two dashes U+002D U+002D".

SimonSapin avatar Aug 27 '17 13:08 SimonSapin

So you are saying that it shouldn't be an error to register a typed custom property with a name that can never be used through CSS, e.g. "--my name here"?

jyc avatar Aug 27 '17 17:08 jyc

You can definitely use that property name, you just need to escape it: --my\20name\20here.

But yeah, need to align this with the other things that register a name without invoking the CSS parser on it.

tabatkins avatar Aug 27 '17 23:08 tabatkins

Thanks! Makes sense.

jyc avatar Aug 27 '17 23:08 jyc

#465 was fixed in ec027417a8 and probably can be closed.

zrhoffman avatar Jun 22 '23 22:06 zrhoffman