Provides resources for parsing style strings.

Constructors

Methods

Constructors

Methods

  • Parse an inline CSS style text string into an object.

    Parameters

    • cssText: string

      Inline CSS style text to parse.

    • Optionaloptions: { camelCase?: boolean }

      Optional settings.

      • OptionalcamelCase?: boolean

        Whether to convert property names to camelCase.

    Returns { [key: string]: string }

    Parsed object of CSS properties.

  • Parses a pixel string / computed styles. Ex. 100px returns 100.

    Parameters

    • value: string

      Value to parse.

    Returns number

    The integer component of a pixel string.

  • Returns the pixel value for 1rem based on the root document element. You may apply an optional multiplier.

    Parameters

    • Optionalmultiplier: number

      Optional multiplier to apply to rem pixel value; default: 1.

    • Optionaloptions: { targetDocument?: Document }

      Optional parameters.

      • OptionaltargetDocument?: Document

        The target DOM Document if different from the main browser global document.

    Returns number

    The pixel value for 1rem with or without a multiplier based on the root document element.