Package | dom.style.css |
Class | public class CSSPrimitiveValue |
Inheritance | CSSPrimitiveValue CSSValue Object |
Introduced in: | DOM 2 Core |
This interface may be used to determine the value of a specific style property currently set in a block or to set a specific style property explicitly within the block. An instance of this interface might be obtained from the getPropertyCSSValue method of the CSSStyleDeclaration interface. A CSSPrimitiveValue object only occurs in a context of a CSS property.
Conversions are allowed between absolute values (from millimeters to centimeters, from degrees to radians, and so on) but not between relative values. (For example, a pixel value cannot be converted to a centimeter value.) Percentage values can't be converted since they are relative to the parent value (or another property value). There is one exception for color percentage values: since a color percentage value is relative to the range 0-255, a color percentage value can be converted to a number; (see also the RGBColor interface).
See also
Property | Defined By | ||
---|---|---|---|
DOM 2 Style cssText : DOMString [read-only]
A string representation of the current value. | CSSValue | ||
DOM 2 Style cssValueType : Number [read-only]
A code defining the type of the value as defined above. | CSSValue | ||
DOM 2 Style primitiveType : Number [read-only]
The type of the value as defined by the constants specified above. | CSSPrimitiveValue |
Method | Defined By | ||
---|---|---|---|
DOM 2 Style getFloatValue(unitType:Number):Number
This method is used to get a float value in a specified unit. | CSSPrimitiveValue | ||
This method is used to get the Rect value. | CSSPrimitiveValue | ||
This method is used to get the RGB color. | CSSPrimitiveValue | ||
This method is used to get the string value. | CSSPrimitiveValue | ||
DOM 2 Style setFloatValue(unitType:Number, floatValue:Number):void
A method to set the float value with a specified unit. | CSSPrimitiveValue | ||
A method to set the string value with the specified unit. | CSSPrimitiveValue |
Constant | Defined By | ||
---|---|---|---|
DOM 2 Style CSS_ATTR : Number = 22
The value is a attribute function. | CSSPrimitiveValue | ||
DOM 2 Style CSS_CM : Number = 6
The value is a length (cm). | CSSPrimitiveValue | ||
DOM 2 Style CSS_COUNTER : Number = 23
The value is a counter or counters function. | CSSPrimitiveValue | ||
DOM 2 Style CSS_CUSTOM : Number = 3
The value is a custom value. | CSSValue | ||
DOM 2 Style CSS_DEG : Number = 11
The value is an angle (deg). | CSSPrimitiveValue | ||
DOM 2 Style CSS_DIMENSION : Number = 18
The value is a number with an unknown dimension. | CSSPrimitiveValue | ||
DOM 2 Style CSS_EMS : Number = 3
The value is a length (ems). | CSSPrimitiveValue | ||
DOM 2 Style CSS_EXS : Number = 4
The value is a length (exs). | CSSPrimitiveValue | ||
DOM 2 Style CSS_GRAD : Number = 13
The value is an angle (grad). | CSSPrimitiveValue | ||
DOM 2 Style CSS_HZ : Number = 16
The value is a frequency (Hz). | CSSPrimitiveValue | ||
DOM 2 Style CSS_IDENT : Number = 21
The value is an identifier. | CSSPrimitiveValue | ||
DOM 2 Style CSS_IN : Number = 8
The value is a length (in). | CSSPrimitiveValue | ||
DOM 2 Style CSS_INHERIT : Number = 0
The value is inherited and the cssText contains "inherit". | CSSValue | ||
DOM 2 Style CSS_KHZ : Number = 17
The value is a frequency (kHz). | CSSPrimitiveValue | ||
DOM 2 Style CSS_MM : Number = 7
The value is a length (mm). | CSSPrimitiveValue | ||
DOM 2 Style CSS_MS : Number = 14
The value is a time (ms). | CSSPrimitiveValue | ||
DOM 2 Style CSS_NUMBER : Number = 1
The value is a simple number. | CSSPrimitiveValue | ||
DOM 2 Style CSS_PC : Number = 10
The value is a length (pc). | CSSPrimitiveValue | ||
DOM 2 Style CSS_PERCENTAGE : Number = 2
The value is a percentage. | CSSPrimitiveValue | ||
DOM 2 Style CSS_PRIMITIVE_VALUE : Number = 1
The value is a primitive value and an instance of the CSSPrimitiveValue
interface can be obtained by using binding-specific casting methods on
this instance of the CSSValue interface. | CSSValue | ||
DOM 2 Style CSS_PT : Number = 9
The value is a length (pt). | CSSPrimitiveValue | ||
DOM 2 Style CSS_PX : Number = 5
The value is a length (px). | CSSPrimitiveValue | ||
DOM 2 Style CSS_RAD : Number = 12
The value is an angle (rad). | CSSPrimitiveValue | ||
DOM 2 Style CSS_RECT : Number = 24
The value is a rect function. | CSSPrimitiveValue | ||
DOM 2 Style CSS_RGBCOLOR : Number = 25
The value is a RGB color. | CSSPrimitiveValue | ||
DOM 2 Style CSS_S : Number = 15
The value is a time (s). | CSSPrimitiveValue | ||
DOM 2 Style CSS_STRING : Number = 19
The value is a STRING. | CSSPrimitiveValue | ||
DOM 2 Style CSS_UNKNOWN : Number = 0
The value is not a recognized CSS2 value. | CSSPrimitiveValue | ||
DOM 2 Style CSS_URI : Number = 20
The value is a URI. | CSSPrimitiveValue | ||
DOM 2 Style CSS_VALUE_LIST : Number = 2
The value is a CSSValue list and an instance of the CSSValueList interface
can be obtained by using binding-specific casting methods on this instance
of the CSSValue interface. | CSSValue |
DOM 2 Style primitiveType | property |
primitiveType:Number
[read-only] Introduced in: | DOM 2 Core |
The type of the value as defined by the constants specified above.
public function get primitiveType():Number
See also
DOM 2 Style getFloatValue | () | method |
public function getFloatValue(unitType:Number):Number
Introduced in: | DOM 2 Core |
This method is used to get a float value in a specified unit. If this CSS value doesn't contain a float value or can't be converted into the specified unit, a DOMException is raised.
Parameters
unitType:Number — A unit code to get the float value. The unit code can only be a float unit type (i.e. CSS_NUMBER,
CSS_PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_DEG, CSS_RAD, CSS_GRAD, CSS_MS, CSS_S, CSS_HZ, CSS_KHZ, CSS_DIMENSION).
|
Number — The float value in the specified unit.
|
DOMException — INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a float value or if the
float value can't be converted into the specified unit.
|
See also
DOM 2 Style getRectValue | () | method |
public function getRectValue():Rect
Introduced in: | DOM 2 Core |
This method is used to get the Rect value. If this CSS value doesn't contain a rect value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Rect interface.
ReturnsRect — The Rect value.
|
DOMException — INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a Rect value. (e.g. this is not CSS_RECT).
|
See also
DOM 2 Style getRGBColorValue | () | method |
public function getRGBColorValue():RGBColor
Introduced in: | DOM 2 Core |
This method is used to get the RGB color. If this CSS value doesn't contain a RGB color value, a DOMException is raised. Modification to the corresponding style property can be achieved using the RGBColor interface.
ReturnsRGBColor — The RGB color value.
|
DOMException — INVALID_ACCESS_ERR: Raised if the attached property can't return a RGB color value (e.g.
this is not CSS_RGBCOLOR).
|
See also
DOM 2 Style getStringValue | () | method |
public function getStringValue():DOMString
Introduced in: | DOM 2 Core |
This method is used to get the string value. If the CSS value doesn't contain a string value, a DOMException is raised.
Note: Some properties (like 'font-family' or 'voice-family') convert a whitespace separated list of idents to a string.
ReturnsDOMString — The string value in the current unit. The current primitiveType can only be a string unit type (i.e. CSS_STRING,
CSS_URI, CSS_IDENT and CSS_ATTR).
|
DOMException — INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string value.
|
See also
DOM 2 Style setFloatValue | () | method |
public function setFloatValue(unitType:Number, floatValue:Number):void
Introduced in: | DOM 2 Core |
A method to set the float value with a specified unit. If the property attached with this value can not accept the specified unit or the float value, the value will be unchanged and a DOMException will be raised.
Parameters
unitType:Number — A unit code as defined above. The unit code can only be a float unit type (i.e. CSS_NUMBER,
CSS_PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_CM, CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_DEG, CSS_RAD, CSS_GRAD, CSS_MS, CSS_S,
CSS_HZ, CSS_KHZ, CSS_DIMENSION).
| |
floatValue:Number — The new float value.
|
DOMException — INVALID_ACCESS_ERR: Raised if the attached property doesn't support the float value or the unit type.
| |
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
|
See also
DOM 2 Style setStringValue | () | method |
public function setStringValue(stringType:Number, stringValue:DOMString):void
Introduced in: | DOM 2 Core |
A method to set the string value with the specified unit. If the property attached to this value can't accept the specified unit or the string value, the value will be unchanged and a DOMException will be raised.
Parameters
stringType:Number — A string code as defined above. The string code can only be a string unit type (i.e. CSS_STRING,
CSS_URI, CSS_IDENT, and CSS_ATTR).
| |
stringValue:DOMString — The new string value.
|
DOMException — INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string value or if the string value
can't be converted into the specified unit.
| |
DOMException — NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
|
See also
DOM 2 Style CSS_ATTR | Constant |
public const CSS_ATTR:Number = 22
Introduced in: | DOM 2 Core |
The value is a attribute function. The value can be obtained by using the getStringValue method.
See also
DOM 2 Style CSS_CM | Constant |
public const CSS_CM:Number = 6
Introduced in: | DOM 2 Core |
The value is a length (cm). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_COUNTER | Constant |
public const CSS_COUNTER:Number = 23
Introduced in: | DOM 2 Core |
The value is a counter or counters function. The value can be obtained by using the getCounterValue method.
See also
DOM 2 Style CSS_DEG | Constant |
public const CSS_DEG:Number = 11
Introduced in: | DOM 2 Core |
The value is an angle (deg). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_DIMENSION | Constant |
public const CSS_DIMENSION:Number = 18
Introduced in: | DOM 2 Core |
The value is a number with an unknown dimension. The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_EMS | Constant |
public const CSS_EMS:Number = 3
Introduced in: | DOM 2 Core |
The value is a length (ems). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_EXS | Constant |
public const CSS_EXS:Number = 4
Introduced in: | DOM 2 Core |
The value is a length (exs). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_GRAD | Constant |
public const CSS_GRAD:Number = 13
Introduced in: | DOM 2 Core |
The value is an angle (grad). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_HZ | Constant |
public const CSS_HZ:Number = 16
Introduced in: | DOM 2 Core |
The value is a frequency (Hz). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_IDENT | Constant |
public const CSS_IDENT:Number = 21
Introduced in: | DOM 2 Core |
The value is an identifier. The value can be obtained by using the getStringValue method.
See also
DOM 2 Style CSS_IN | Constant |
public const CSS_IN:Number = 8
Introduced in: | DOM 2 Core |
The value is a length (in). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_KHZ | Constant |
public const CSS_KHZ:Number = 17
Introduced in: | DOM 2 Core |
The value is a frequency (kHz). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_MM | Constant |
public const CSS_MM:Number = 7
Introduced in: | DOM 2 Core |
The value is a length (mm). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_MS | Constant |
public const CSS_MS:Number = 14
Introduced in: | DOM 2 Core |
The value is a time (ms). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_NUMBER | Constant |
public const CSS_NUMBER:Number = 1
Introduced in: | DOM 2 Core |
The value is a simple number. The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_PC | Constant |
public const CSS_PC:Number = 10
Introduced in: | DOM 2 Core |
The value is a length (pc). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_PERCENTAGE | Constant |
public const CSS_PERCENTAGE:Number = 2
Introduced in: | DOM 2 Core |
The value is a percentage. The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_PT | Constant |
public const CSS_PT:Number = 9
Introduced in: | DOM 2 Core |
The value is a length (pt). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_PX | Constant |
public const CSS_PX:Number = 5
Introduced in: | DOM 2 Core |
The value is a length (px). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_RAD | Constant |
public const CSS_RAD:Number = 12
Introduced in: | DOM 2 Core |
The value is an angle (rad). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_RECT | Constant |
public const CSS_RECT:Number = 24
Introduced in: | DOM 2 Core |
The value is a rect function. The value can be obtained by using the getRectValue method.
See also
DOM 2 Style CSS_RGBCOLOR | Constant |
public const CSS_RGBCOLOR:Number = 25
Introduced in: | DOM 2 Core |
The value is a RGB color. The value can be obtained by using the getRGBColorValue method.
See also
DOM 2 Style CSS_S | Constant |
public const CSS_S:Number = 15
Introduced in: | DOM 2 Core |
The value is a time (s). The value can be obtained by using the getFloatValue method.
See also
DOM 2 Style CSS_STRING | Constant |
public const CSS_STRING:Number = 19
Introduced in: | DOM 2 Core |
The value is a STRING. The value can be obtained by using the getStringValue method.
See also
DOM 2 Style CSS_UNKNOWN | Constant |
public const CSS_UNKNOWN:Number = 0
Introduced in: | DOM 2 Core |
The value is not a recognized CSS2 value. The value can only be obtained by using the cssText attribute.
See also
DOM 2 Style CSS_URI | Constant |
public const CSS_URI:Number = 20
Introduced in: | DOM 2 Core |
The value is a URI. The value can be obtained by using the getStringValue method.
See also