#402: @property

Visit on Github.

Opened Aug 7, 2019

こんにちはTAG!

I'm requesting a TAG review of:

  • Name: @property (part of CSS Properties and Values API Level 1, #318)
  • Specification URL: The @property rule
  • GitHub issues: https://github.com/w3c/css-houdini-drafts/issues, use [css-properties-values-api] prefix in the title of issues.
  • Tests: Blink-specific test (will "upgrade" to WPT).
  • Primary contacts (and their relationship to the specification): @andruud (Chrome implementor), @tabatkins (editor)
  • I added a (very) brief description of this feature near the bottom.

Further details:

We'd prefer the TAG provide feedback as (please select one):

  • open issues in our GitHub repo for each point of feedback
  • open a single issue in our GitHub repo for the entire review
  • leave review feedback as a comment in this issue and @-notify [github usernames]

Description:

The @property rule is briefly put a way to register a custom property in pure CSS.

For example, the two pieces of code (JS and CSS respectively) are equivalent, and result in exactly the same property registration:

CSS.registerProperty({
  name: '--x',
  syntax: '<length>',
  inherits: false,
  initialValue: '0px'
});
@property --x {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

Authors often just want make a custom property animatable, and having to resort to JS just for this is not always desirable or possible (e.g. JS may be disabled).

See also the amount of exceitement on the original proposal (reactions at the bottom of the first post).

Notable resolved issues:

Discussions