941ee630d8
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
30 lines
619 B
Plaintext
30 lines
619 B
Plaintext
= Gerrit Code Review - Plugin styles API
|
|
|
|
This API is provided by link:pg-plugin-dev.html#plugin-styles[plugin.styles()]
|
|
and provides a way to apply dynamically created styles to elements in a
|
|
document.
|
|
|
|
[[css]]
|
|
== css
|
|
`styles.css(rulesStr)`
|
|
|
|
.Params
|
|
- `*string* rulesStr` string with CSS styling declarations.
|
|
|
|
Example:
|
|
----
|
|
const styleObject = plugin.styles().css('background: black; color: white;');
|
|
...
|
|
const className = styleObject.getClassName(element)
|
|
...
|
|
element.classList.add(className);
|
|
...
|
|
styleObject.apply(someOtherElement);
|
|
----
|
|
|
|
.Returns
|
|
- Instance of link:pg-plugin-style-object.html[GrStyleObject].
|
|
|
|
|
|
|