Store information about css style properties. You can’t create this object directly. Instead you should use the css method. This object allows to apply style correctly to elements within different shadow subtree.

getClassName

styleObject.getClassName(element)

Params
  • element - an HTMLElement.

Returns
  • string - class name. The class name is valid only within the shadow root of element.

Creates a new unique CSS class and injects it into the appropriate place in DOM (it can be document or shadow root for element). This class can be later added to the element or to any other element in the same shadow root. It is guarantee, that method adds CSS class only once for each shadow root.

apply

styleObject.apply(element)

Params
  • element - element to apply style.

Create a new unique CSS class (see getClassName) and adds class to the element.