pseudo-dom
    Preparing search index...

    Class CSSStyleDeclarationService

    Simulate the behaviour of the CSSStyleDeclaration Class when there is no DOM available: an ordered map of CSS property/value pairs, parsed from and serialized back to a cssText string. Values are stored and returned as given, with no unit conversion, shorthand expansion or validation - this is a data structure, not a real CSS engine. Named property access (declaration.backgroundColor, camelCase) is added on top of this by createStyleDeclaration, which wraps an instance of this class in a Proxy.

    Index
    • "important" when the property was set with !important, otherwise ''.

      Parameters

      • property: string

        A CSS property name (kebab-case)

      Returns string

    • The value of the given property, or '' when it is not set.

      Parameters

      • property: string

        A CSS property name (kebab-case, e.g. "background-color")

      Returns string

    • The name of the property at the given index, in the order it was set, or '' when there is none (matches the DOM's CSSStyleDeclaration, which is array-like).

      Parameters

      • index: number

      Returns string

    • Remove a property, returning the value it had (or '' when it was not set).

      Parameters

      • property: string

        A CSS property name (kebab-case)

      Returns string

    • Set a property's value (and optionally its priority). An empty, null or undefined value removes the property instead, like the DOM.

      Parameters

      • property: string

        A CSS property name (kebab-case)

      • value: string

        The value, or '' to remove the property

      • priority: string = ''

        "important" to mark it !important

      Returns void