This is used to wrap a CSSStyleSheet to provide convenient methods for styling and 'unstyling' elements.

Example

import { StyleSheet } from 'deleight/sophistry';
const sss = new StyleSheet(css);

Constructors

Properties

Methods

Constructors

Properties

css: CSSStyleSheet

The wrapped CSS stylesheet.

Methods

  • Removes the wrapped stylesheet from the elements (or their shadow roots).

    Type Parameters

    • T extends Element | DocumentFragment

    Parameters

    • Rest ...elements: T[]

    Returns void

    Example

    sss.remove(...Array.from(document.body.children))
    
  • Styles the elements with the wrapped CSSStylesheets. If an element is not the document or a shadow root, an open shadow root is created for it and then the rrot is styled.

    Type Parameters

    • T extends Element | DocumentFragment

    Parameters

    • Rest ...elements: T[]

    Returns void

    Example

    sss.style(...Array.from(document.body.children))