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
-
An absolute length measured in millimeters. Query with
getFloatValue( ).
- unsigned short CSS_IN = 8
-
An absolute length measured in inches. Query with
getFloatValue( ).
- unsigned short CSS_PT = 9
-
An absolute length measured in points (1/72 of an inch). Query with
getFloatValue( ).
- unsigned short CSS_PC = 10
-
An absolute length measured in picas (12 points). Query with
getFloatValue( ).
- unsigned short CSS_DEG = 11
-
An angle measured in degrees. Query with getFloatValue(
).
- unsigned short CSS_RAD = 12
-
An angle measured in radians. Query with getFloatValue(
).
- unsigned short CSS_GRAD = 13
-
An angle measured in grads. Query with getFloatValue(
).
- unsigned short CSS_MS = 14
-
A time measured in milliseconds. Query with getFloatValue(
).
- unsigned short CSS_S = 15
-
A time measured in seconds. Query with getFloatValue(
).
- unsigned short CSS_HZ = 16
-
A frequency measured in hertz. Query with getFloatValue(
).
- unsigned short CSS_KHZ = 17
-
A frequency measured in kilohertz. Query with getFloatValue(
).
- unsigned short CSS_DIMENSION = 18
-
A unitless dimension. Query with getFloatValue( ).
- unsigned short CSS_STRING = 19
-
A string. Query with getStringValue( ).
- unsigned short CSS_URI = 20
-
A URI. Query with getStringValue( ).
- unsigned short CSS_IDENT = 21
-
An identifier. Query with getStringValue( ).
- unsigned short CSS_ATTR = 22
-
An attribute function. Query with getStringValue(
).
- unsigned short CSS_COUNTER = 23
-
A counter. Query with getCounterValue( ).
- unsigned short CSS_RECT = 24
-
A rectangle. Query with getRectValue( ).
- unsigned short CSS_RGBCOLOR = 25
-
A color. Query with getRGBColorValue( ).
Properties
- readonly unsigned short primitiveType
-
The
type of this value. This property holds one of the constants defined
in the previous section.
Methods
- getCounterValue( )
-
For values of type CSS_COUNTER, returns the
Counter object that represents the value.
- getFloatValue( )
-
Returns a numeric value, converting it, if necessary, to the
specified units.
- getRectValue( )
-
For values of type CSS_RECT, returns the Rect
object that represents the value.
- getRGBColorValue( )
-
For values of type CSS_RGBCOLOR, returns the
RGBColor object that represents the value.
- getStringValue( )
-
Returns the value as a string.
- setFloatValue( )
-
Sets a numeric value to the specified number of the specified units.
- setStringValue( )
-
Sets a string value to the specified string of the specified type.
Description
This subinterface of CSSValue represents a single CSS value. Contrast
it with the CSSValueList interface, which represents a list of CSS
values. The word "primitive" in the name of this
interface is misleading; this interface can represent some complex
types of CSS values, such as counters, rectangles, and colors.
The primitiveType property holds one of the
previously defined constants and specifies the type of the value. The
various methods defined by this interface allow you to query values
of various types and also to set numeric and string values.
See Also
Counter, CSSValue, CSSValueList, Rect, RGBColor
Type of
RGBColor.blue, RGBColor.green, RGBColor.red, Rect.bottom, Rect.left,
Rect.right, Rect.top
|