blob: cdcfb557d7b3fd2588af84441bfa35713c063d37 [file] [log] [blame] [edit]
= Gerrit Code Review - GrStyleObject
Store information about css style properties. You can't create this object
directly. Instead you should use the link:pg-plugin-styles-api.html#css[css] method.
This object allows to apply style correctly to elements within different shadow
subtree.
[[get-class-name]]
== 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 link:#get-class-name[getClassName]) and
adds class to the element.