CSSPrimitiveValue class

CSSPrimitiveValue class

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 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.

Inheritance: CSSPrimitiveValueCSSValueDOMObject

The CSSPrimitiveValue type exposes the following members:

Properties

PropertyDescription
css_textA string representation of the current value.
css_value_typeA code defining the type of the value.
CSS_INHERITThe value is inherited and the cssText contains “inherit”.
CSS_PRIMITIVE_VALUEThe 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.
CSS_VALUE_LISTThe 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.
CSS_CUSTOMThe value is a custom value.
primitive_typeThe type of the value as defined by the constants specified above.
CSS_UNKNOWNThe value is not a recognized CSS2 value. The value can only be obtained by using the cssText attribute.
CSS_NUMBERThe value is a simple number. The value can be obtained by using the getFloatValue method.
CSS_PERCENTAGEThe value is a percentage. The value can be obtained by using the getFloatValue method.
CSS_EMSThe value is a length (ems). The value can be obtained by using the getFloatValue method.
CSS_EXSThe value is a length (exs). The value can be obtained by using the getFloatValue method.
CSS_PXThe value is a length (px). The value can be obtained by using the getFloatValue method.
CSS_CMThe value is a length (cm). The value can be obtained by using the getFloatValue method.
CSS_MMThe value is a length (mm). The value can be obtained by using the getFloatValue method.
CSS_INThe value is a length (in). The value can be obtained by using the getFloatValue method.
CSS_PTThe value is a length (pt). The value can be obtained by using the getFloatValue method.
CSS_PCThe value is a length (pc). The value can be obtained by using the getFloatValue method.
CSS_DEGThe value is an angle (deg). The value can be obtained by using the getFloatValue method.
CSS_RADThe value is an angle (rad). The value can be obtained by using the getFloatValue method.
CSS_GRADThe value is an angle (grad). The value can be obtained by using the getFloatValue method.
CSS_MSThe value is a time (ms). The value can be obtained by using the getFloatValue method.
CSS_SThe value is a time (s). The value can be obtained by using the getFloatValue method.
CSS_HZThe value is a frequency (Hz). The value can be obtained by using the getFloatValue method.
CSS_KHZThe value is a frequency (kHz). The value can be obtained by using the getFloatValue method.
CSS_DIMENSIONThe value is a number with an unknown dimension. The value can be obtained by using the getFloatValue method.
CSS_REMThe value is a length (rem). The value can be obtained by using the getFloatValue method.
CSS_CHThe value is a length (ch). The value can be obtained by using the getFloatValue method.
CSS_STRINGThe value is a STRING. The value can be obtained by using the getStringValue method.
CSS_URIThe value is a URI. The value can be obtained by using the getStringValue method.
CSS_IDENTThe value is an identifier. The value can be obtained by using the getStringValue method.
CSS_ATTRThe value is a attribute function. The value can be obtained by using the getStringValue method.
CSS_COUNTERThe value is a counter or counters function. The value can be obtained by using the GetCounterValue method.
CSS_RECTThe value is a rect function. The value can be obtained by using the GetRectValue method.
CSS_RGBCOLORThe value is a RGB color. The value can be obtained by using the GetRGBColorValue method.
CSS_DPIThe value is a dots per inch (dpi).
CSS_DPCMThe value is a dots per centimeter (dpcm).
CSS_DPPXThe value is a dots per ‘px’ unit (dppx).
CSS_VWThe value is a percentage of the full viewport width.
CSS_VHThe value is a percentage of the full viewport height.
CSS_VMINThe value is a percentage of the viewport width or height, whichever is smaller.
CSS_VMAXThe value is a percentage of the viewport width or height, whichever is larger.

Methods

MethodDescription
get_platform_typeThis method is used to retrieve ECMAScript object Type.
set_float_valueA 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.
get_float_valueThis 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.
set_int_valueA method to set the int value with a specified unit. If the property attached with this value can not accept the specified unit or the int value, the value will be unchanged and a DOMException will be raised.
get_int_valueThis method is used to get an int value in a specified unit. If this CSS value doesn’t contain an int value or can’t be converted into the specified unit, a DOMException is raised.
set_string_valueA 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.
get_string_valueThis method is used to get the string value. If the CSS value doesn’t contain a string value, a DOMException is raised.
get_counter_valueThis 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.
get_rect_valueThis 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.
get_rgb_color_valueThis 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.

See Also