Skip to content

registerProperty/unregisterProperty should be clearer about escaping of property name #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dbaron opened this issue Aug 23, 2016 · 3 comments

Comments

@dbaron
Copy link
Member

dbaron commented Aug 23, 2016

The definition of registerProperty() and unregisterProperty() should be clearer about CSS escaping of the property name. It says that the name given has to match a CSS production that does include escaping, but it doesn't actually say that that CSS escaping is processed in the production of the property name that is actually registered, or that registering and unregistering by different strings that are equivalent once escaping is processed properly unregisters, or similar for registering twice throwing an exception.

@tabatkins
Copy link
Member

It looks like we don't currently CSS-parse it, and instead just take it literally.

If you run:

CSS.registerProperty({
   name:"--f\\30o", 
   syntax:"<color>", 
   initialValue:"blue", 
   inherits:false});

then getComputedStyle(document.body).getPropertyValue("--f\\30o") returns blue, while getComputedStyle(document.body).getPropertyValue("--f0o") returns the empty string.

So yeah, I'm fine with specifying, like in other parts of the platform and TypedOM, that the name is taken literally.

@tabatkins
Copy link
Member

(Done in ec02741)

@tabatkins
Copy link
Member

(and also in 17d9a30 just now for additional cleanup)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants