Skip to content
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

[css-properties-values-api] @property vs registerProperty #845

Closed
andruud opened this issue Dec 12, 2018 · 3 comments
Closed

[css-properties-values-api] @property vs registerProperty #845

andruud opened this issue Dec 12, 2018 · 3 comments

Comments

@andruud
Copy link
Member

andruud commented Dec 12, 2018

I assume @property rules overwrite previous rules with the same name, e.g. if you specify the following, then --x is a <length>, and not a <color>:

@property --x { syntax: "<color>"; inherits: false; initial-value: red; }
@property --x { syntax: "<length>"; inherits: false; initial-value: 10px; }

However, what happens when registerProperty and @property are competing? Currently, registerProperty fails if something is already registered, yet for @property it's probably more natural that it re-registers the property.

Proposal:

  • registerProperty fails is the property is already registered, regardless of the origin of that registration.
  • @property will re-register the property if the current registration originated from @property, but fails (i.e. has no effect) if the current registration originated from registerProperty.
andruud added a commit to andruud/css-houdini-drafts that referenced this issue Dec 12, 2018
This adds basic support for @Property, without solving any of the
potentially complicated issues, like w3c#845 and w3c#846.

Resolves w3c#137, at least partially.
@emilio
Copy link
Contributor

emilio commented Jun 21, 2019

Copy pasting from #902:

I think the easiest solution to that problem is saying that they're independent (that is, you can't unregisterProperty a property registered via @Property, and vice-versa, and then you just need to specify in which order do we look at the two sets if there's a name conflict).

@tabatkins
Copy link
Member

Agree. I'm inclined to have script-registered properties win over rule-registered ones.

andruud added a commit to andruud/css-houdini-drafts that referenced this issue Jul 2, 2019
This adds basic support for @Property, without solving any of the
potentially complicated issues, like w3c#845 and w3c#846.

Resolves w3c#137, at least partially.
tabatkins pushed a commit that referenced this issue Jul 22, 2019
* [css-properties-values-api] Add @Property.

This adds basic support for @Property, without solving any of the
potentially complicated issues, like #845 and #846.

Resolves #137, at least partially.

* Remove merge conflict things.

* Rewrapping, tiny wording tweaks, IDL/linking fixes
@tabatkins
Copy link
Member

All right, specced that @Property rules for the same name have last-wins semantics, and that registerProperty() wins over @Property rules.

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

3 participants