2

There is a draft of such feature as CSS.registerProperty. In fact it allows to define types for css variables so that browser will be able to extend its abilities about them including animating values.

For me it seems strange that the feature that can be used for css-only perpouses (example) has only javascript representation and can't be used from pure css.

Is there any reason to include it in javascript but not propose same thing for css?


The things that I can't do from css now:

  • Specify the type (syntax) - without it css animation wouldn't work (the same example)
  • Specify inherits: false
4

1 回答 1

1

实际上已经讨论过了,如果事情进展顺利,我们应该能够使用@property规则。

当前的讨论会将您的 js 转换为

@property --alpha {
  syntax: "<number>"; 
  initialValue: 1;
  inherits: true;
})
于 2019-03-07T06:33:02.887 回答