Note: This feature is available in Web Workers.
The CSSMathInvert() constructor creates a new CSSMathInvert object which represents the inverse (reciprocal) of a CSSNumericValue.
new CSSMathInvert(arg)argA number or CSSNumericValue that represents the value to invert.
None.
The following code creates a CSSMathInvert object from a percentage, then logs the constructor name, value, and the object's serialization (from toString()).
const inverted = new CSSMathInvert(CSS.percent(4));
console.log(inverted.constructor.name); // "CSSMathInvert"
console.log(inverted.value); // CSSUnitValue {value: 4, unit: "percent"}
console.log(inverted.toString()); // "calc(1 / 4%)"Note that if a plain number is passed to arg, the value is rectified to a CSSUnitValue with unit "number":
const invertedNumber = new CSSMathInvert(4);
console.log(invertedNumber.value); // CSSUnitValue {value: 4, unit: "number"}