Interface CSSPrimitiveValue

All Superinterfaces:
Cloneable, CSSValue
All Known Subinterfaces:
CSSAttrValue, CSSColorValue, CSSCountersValue, CSSCounterValue, CSSEnvVariableValue, CSSExpressionValue, CSSFunctionValue, CSSGradientValue, CSSLexicalValue, CSSRatioValue, CSSTypedValue, CSSUnicodeRangeValue, CSSUnicodeRangeValue.CSSUnicodeValue, CSSVarValue, HSLColorValue, HWBColorValue, LABColorValue, LCHColorValue, RGBColorValue
All Known Implementing Classes:
AttrValue, CalcValue, ColorValue, EnvVariableValue, ExpressionValue, FunctionValue, GradientValue, HSLColorValue, HWBColorValue, IdentifierValue, LABColorValue, LCHColorValue, LexicalValue, NumberValue, PercentageValue, PrimitiveValue, ProxyValue, RatioValue, RectValue, RGBColorValue, StringValue, SystemDefaultValue, TypedValue, UnicodeRangeValue, UnicodeValue, UnicodeWildcardValue, UnknownValue, URIValue, URIValueWrapper, VarValue

public interface CSSPrimitiveValue extends CSSValue
A CSS primitive value.

Primitive values include two categories: TYPED and PROXY values.

  • Method Details

    • setExpectInteger

      void setExpectInteger() throws DOMException
      This value is expected to contain an integer.

      If this value is a non-integer number, an exception will be thrown immediately.

      If this value is a calc() that ever produces a non-integer number, the value shall be rounded to the nearest integer.

      If the value is a proxy that ever produces other than an integer number (without calc() involvement), an exception should be thrown later.

      Throws:
      DOMException - TYPE_MISMATCH_ERR if the value is a constant number and not an integer.
    • isNegativeNumber

      default boolean isNegativeNumber()
      Test whether this is a numeric value that is less than zero.
      Returns:
      true if this is a numeric value and its value is negative.
    • getUnitType

      default short getUnitType()
      If this is a numeric value, get its unit type.
      Returns:
      the unit type, CSS_INVALID if the unit or type are not valid.