草案
此页面不完整。
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
CSSMathValue.operator
只读特性在
CSSMathValue
interface indicates the operator that the current subtype represents. For example, if the current
CSSMathValue
subtype is
CSSMathSum
, this property will return the string
"sum"
.
var aString = CSSMathValue.operator;
A
字符串
.
| 接口 | 值 |
|---|---|
|
"sum"
|
|
"product"
|
|
"min"
|
|
"max"
|
|
"clamp"
|
|
"negate"
|
|
"invert"
|
We create an element with a
width
determined using a
calc()
function, then
console.log()
the
operator
.
<div>My width has a <code>calc()</code> function</div>
We assign a
width
with a calculation
div {
width: calc(50% - 0.5vw);
}
We add the JavaScript
const styleMap = document.querySelector('div').computedStyleMap();
console.log( styleMap.get('width') ); // CSSMathSum {values: CSSNumericArray, operator: "sum"}
console.log( styleMap.get('width').values ); // CSSNumericArray {0: CSSUnitValue, 1: CSSMathNegate, length: 2}
console.log( styleMap.get('width').operator ); // 'sum'
console.log( styleMap.get('width').values[1].operator ) // 'negate'
CSSMathValue.operator
返回
sum
for the equation and
negate
for the operator on the second value.
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Typed OM Level 1
The definition of 'CSSMathValue.operator' in that specification. |
工作草案 | 初始定义。 |
No compatibility data found. Please contribute data for "api.CSSMathValue.CSSMathValue.operator" (depth: 1) to the MDN 兼容性数据存储库 .
CSSMathValue
operator