javascript - Why CSS.registerProperty is in Javascript but not in CSS?
问题描述
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
解决方案
实际上已经讨论过了,如果事情进展顺利,我们应该能够使用@property
规则。
当前的讨论会将您的 js 转换为
@property --alpha {
syntax: "<number>";
initialValue: 1;
inherits: true;
})
推荐阅读
- python-3.x - 使用张量流的 CNN 中的尺寸错误
- c# - 安全地暂停线程
- visual-studio-code - 如何仅按特定文件类型而不是文件夹搜索 vscode
- scalajs-bundler - 无法让任何 scalajs-bundler 样本工作
- sass - 在 sass 函数中使用 css 变量 - node-sass
- powershell - 使用 if 条件检查命令执行状态
- sql - 有没有办法从 XML 中找出特定的标签值?
- mysql - 如何在状态= 2的mysql中使用if条件
- sql - SQL BigQuery:选择基于时间的查询
- c# - C# HtmlAgilityPack - GetAttributeValue 返回 false bool