gerrit/Documentation/pg-plugin-style-object.txt
Dmitrii Filippov 941ee630d8 Deprecate Gerrit.css() and provide a replacement
Gerrit.css doesn't work with ShadowDom, because it adds styles to a
document. This fix provides a replacement for Gerrit.css. The
replacement allows to apply the same styles to any element inside
document.

Bug: Issue 11298
Change-Id: Ide325a889a69bd267382a9664ed6f8d25ed67a3b
2019-08-22 15:53:32 +00:00

34 lines
991 B
Plaintext

= 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.