草案
此页面不完整。

这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

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 字符串 .

接口
CSSMathSum "sum"
CSSMathProduct "product"
CSSMathMin "min"
CSSMathMax "max"
CSSMathClamp "clamp"
CSSMathNegate "negate"
CSSMathInvert "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.
工作草案 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

No compatibility data found. Please contribute data for "api.CSSMathValue.CSSMathValue.operator" (depth: 1) to the MDN 兼容性数据存储库 .

元数据

  • 最后修改:
  1. CSSMathValue
  2. 特性
    1. operator