# class CSSPrimitiveValue

###

Module | khtml
Namespace | DOM
Class | CSSPrimitiveValue
Inherits | DOM::CSSValue

The CSSPrimitiveValue interface represents a single CSS value . 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 properties explicitly within the block. An instance of this interface can be obtained from the getPropertyCSSValue method of the CSSStyleDeclaration interface.

### enums

- UnitTypes { CSS_UNKNOWN, 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, CSS_STRING, CSS_URI, CSS_IDENT, CSS_ATTR, CSS_COUNTER, CSS_RECT, CSS_RGBCOLOR, CSS_DPI, CSS_DPCM, CSS_PAIR, CSS_HTML_RELATIVE }
- UnitTypes { CSS_UNKNOWN, 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, CSS_STRING, CSS_URI, CSS_IDENT, CSS_ATTR, CSS_COUNTER, CSS_RECT, CSS_RGBCOLOR, CSS_PAIR, CSS_HTML_RELATIVE }

enum details

### methods

- CSSPrimitiveValue ( )

  returns ctor

- CSSPrimitiveValue (other)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  other | DOM.CSSPrimitiveValue |

- CSSPrimitiveValue (other)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  other | DOM.CSSValue |

- CSSPrimitiveValue (impl)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  impl | CSSPrimitiveValueImpl |

- getCounterValue ( )

  returns DOM.Counter

  This method is used to get the Counter value. If this CSS value doesn't contain a counter value, a DOMException is raised. Modification to the corresponding style property can be achieved using the Counter interface.

  Returns The Counter value.

  DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a Counter value.

- getFloatValue (unitType)

  returns float

  Argument | Type | Default
  --- | --- | ---
  unitType | unsigned short |

  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.

  unitType - A unit code to get the float value. The unit code can only be a float unit type (e.g. CSS_NUMBER , CSS_PERCENTAGE , CSS_EMS , CSS_EXS , CSS_PX , 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 ).

  Returns The float value in the specified unit.

  DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a float value or if the float value can't be converted into the specified unit.

- getRGBColorValue ( )

  returns DOM.RGBColor

  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.

  Returns the RGB color value.

  DOMException INVALID_ACCESS_ERR: Raises if the attached property can't return a RGB color value.

- getRectValue ( )

  returns DOM.Rect

  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.

  Returns The Rect value.

  DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a Rect value.

- getStringValue ( )

  returns DOM.DOMString

  This method is used to get the string value in a specified unit. If the CSS value doesn't contain a string value, a DOMException is raised.

  Returns The string value in the current unit. The current valueType can only be a string unit type (e.g. CSS_URI , CSS_IDENT and CSS_ATTR ).

  DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a string value.

- primitiveType ( )

  returns unsigned short

  The type of the value as defined by the constants specified above.

- setFloatValue (unitType, floatValue)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  unitType | unsigned short |
  floatValue | float |

  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.

  unitType - A unit code as defined above. The unit code can only be a float unit type (e.g. NUMBER , PERCENTAGE , CSS_EMS , CSS_EXS , CSS_PX , 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 - The new float value.

  Returns DOMException INVALID_ACCESS_ERR: Raises if the attached property doesn't support the float value or the unit type.

  NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.

- setStringValue (stringType, stringValue)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  stringType | unsigned short |
  stringValue | DOM.DOMString |

  A method to set the string value with a 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.

  stringType - A string code as defined above. The string code can only be a string unit type (e.g. CSS_URI , CSS_IDENT , CSS_INHERIT and CSS_ATTR ).

  stringValue - The new string value. If the stringType is equal to CSS_INHERIT , the stringValue should be inherit .

  Returns DOMException INVALID_ACCESS_ERR: Raises if the CSS value doesn't contain a string value or if the string value can't be converted into the specified unit.

  NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.

### enums - detail

- UnitTypes { CSS_UNKNOWN, 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, CSS_STRING, CSS_URI, CSS_IDENT, CSS_ATTR, CSS_COUNTER, CSS_RECT, CSS_RGBCOLOR, CSS_DPI, CSS_DPCM, CSS_PAIR, CSS_HTML_RELATIVE }

  An integer indicating which type of unit applies to the value.

  | CSS_UNKNOWN | - 0 | - |
  | CSS_NUMBER | - 1 | - |
  | CSS_PERCENTAGE | - 2 | - |
  | CSS_EMS | - 3 | - |
  | CSS_EXS | - 4 | - |
  | CSS_PX | - 5 | - |
  | CSS_CM | - 6 | - |
  | CSS_MM | - 7 | - |
  | CSS_IN | - 8 | - |
  | CSS_PT | - 9 | - |
  | CSS_PC | - 10 | - |
  | CSS_DEG | - 11 | - |
  | CSS_RAD | - 12 | - |
  | CSS_GRAD | - 13 | - |
  | CSS_MS | - 14 | - |
  | CSS_S | - 15 | - |
  | CSS_HZ | - 16 | - |
  | CSS_KHZ | - 17 | - |
  | CSS_DIMENSION | - 18 | - |
  | CSS_STRING | - 19 | - |
  | CSS_URI | - 20 | - |
  | CSS_IDENT | - 21 | - |
  | CSS_ATTR | - 22 | - |
  | CSS_COUNTER | - 23 | - |
  | CSS_RECT | - 24 | - |
  | CSS_RGBCOLOR | - 25 | - |
  | CSS_DPI | - 26 | - |
  | CSS_DPCM | - 27 | - |
  | CSS_PAIR | - 100 | - |
  | CSS_HTML_RELATIVE | - 255 | - |

- UnitTypes { CSS_UNKNOWN, 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, CSS_STRING, CSS_URI, CSS_IDENT, CSS_ATTR, CSS_COUNTER, CSS_RECT, CSS_RGBCOLOR, CSS_PAIR, CSS_HTML_RELATIVE }

  | CSS_UNKNOWN | - | - |
  | 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 | - | - |
  | CSS_STRING | - | - |
  | CSS_URI | - | - |
  | CSS_IDENT | - | - |
  | CSS_ATTR | - | - |
  | CSS_COUNTER | - | - |
  | CSS_RECT | - | - |
  | CSS_RGBCOLOR | - | - |
  | CSS_PAIR | - | - |
  | CSS_HTML_RELATIVE | - | - |