Creates <style> elements in <head> with css rules and provides createElement much like document.createElement but adds the necessary CSS class right away.

Constructors

  • Creates the css rules maintainer.

    Parameters

    • styleStrategy: "text" | "api" = 'text'

      is the strategy to use when adding rules to the <head><style> element. With api, CSSStyleSheet.insertRule() is used with the downside, that the style element will not show the rule text. With text, the rules are added as text to the generated style element and can be easily inspected with the browser's developer toolbox.

    Returns CssRules

Methods

  • Creates an html element with document.createElement, adds the css class from the rules provider and installs the rules if this is the first time we see the css class.

    Type Parameters

    • K extends keyof HTMLElementTagNameMap

    Parameters

    Returns HTMLElementTagNameMap[K]

Generated using TypeDoc