Name

CSSPrimitiveValue — a single CSS style value

Availability

DOM Level 2 CSS

Inherits from/Overrides

CSSValue CSSPrimitiveValue

Constants

The following constants are the legal values for the primitiveType property. They specify the type of the value and, for numeric values, the units in which the value is represented.

unsigned short CSS_UNKNOWN = 0

The value is not recognized, and the implementation does not know how to parse it. The textual representation of the value is available through the cssText property.

unsigned short CSS_NUMBER = 1

A unitless number. Query with getFloatValue( ).

unsigned short CSS_PERCENTAGE = 2

A percentage. Query with getFloatValue( ).

unsigned short CSS_EMS = 3

A relative length measured in ems (the height of the current font). Query with getFloatValue( ).

unsigned short CSS_EXS = 4

A relative length measured in exs (the “x-height” of the current font). Query with getFloatValue( ).

unsigned short CSS_PX = 5

A length measured in pixels. Query with getFloatValue( ). Pixel lengths are relative measurements, in the sense that their size depends on the display resolution, and they cannot be converted to inches, millimeters, points, or other absolute lengths. However, pixels are also one of the most commonly used units, and they are treated as absolute values for the purposes of AbstractView.getComputedStyle( ), for example.

unsigned short CSS_CM = 6

An absolute length measured in centimeters. Query with getFloatValue( ).

unsigned short CSS_MM = 7 ...

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.