Firefox Tomorrow

web api static method

CSSNumericValue: parse() static method

View on MDN ↗

The parse() static method of the CSSNumericValue interface converts a value string into an object whose members are value and the units.

Syntax

CSSNumericValue.parse(cssText)

Parameters

  • cssText
    • : a string containing numeric and unit parts.

Return value

A CSSNumericValue.

Exceptions

Examples

The following returns a CSSUnitValue object with a unit property equal to "px" and a value property equal to 42.

let numValue = CSSNumericValue.parse("42.0px");

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.