Skip to content

[css-properties-values-api] Apply hook limits use of custom property value on the same element #39

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

Open
gregwhitworth opened this issue Sep 1, 2015 · 0 comments

Comments

@gregwhitworth
Copy link
Contributor

This was in the spec initially as a problem so I'm converting it to an issue so I can pull it out of the spec.

The apply model means that you can't have two custom properties that apply to the same used values coexisting on the same element. This is especially important to point out since our expectation is for these APIs to be utilized by libs and authors may not be aware of the conflicts.

registerProperty({
  name: '--layout',
  syntax: '<string>',
  inherit: false,
  initialValue: 'none',
  apply: function(used, value) {
    if (value == 'grid') {
        used.width = '500px';
    }
  }
});
registerProperty({
  name: '--extraBorder',
  syntax: '<length>',
  inherit: false,
  initialValue: '0px',
  apply: function(used, value) {
    used.width += value;
  }
});
@shans shans changed the title [css-properties-values] Apply hook limits use of custom property value on the same element [css-properties-values-api] Apply hook limits use of custom property value on the same element Oct 29, 2015
majido pushed a commit to majido/css-houdini-drafts that referenced this issue Aug 8, 2018
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