Draft
This page is not complete.
Experimental
This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The parse()
method of the
CSSNumericValue
interface converts a value string into an object whose
members are value and the units.
Syntax
var cssNumericValue = CSSNumericValue.parse(cssText);
Parameters
- cssText
- a string containing numeric and unit parts.
Return value
Exceptions
- SyntaxError
- TBD
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
Specification | Status | Comment |
---|---|---|
CSS Typed OM Level 1 The definition of 'parse' in that specification. |
Working Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser