Limited availability
The CSSMathValue
interface of the CSS Typed Object Model API a base class for classes representing complex numeric values.
Below is a list of interfaces based on the CSSMathValue interface.
Instance propertiesCSSMathValue.operator
Indicates the operator that the current subtype represents.
The interface may also inherit methods from its parent interface, CSSNumericValue
.
The interface may also inherit methods from its parent interface, CSSNumericValue
.
We create an element with a width
determined using a calc()
function, then console.log()
the operator
.
We assign a width
with a calculation
div {
width: calc(30% - 20px);
}
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").operator); // 'sum'
console.log(styleMap.get("width").values[1].value); // -20
The CSSMathValue.operator
returns "sum"
because styleMap.get("width").values[1].value );
is -20
: adding a negative number.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4