Dmitrii Filippov | 941ee63 | 2019-08-22 15:52:37 +0000 | [diff] [blame] | 1 | = Gerrit Code Review - Plugin styles API |
| 2 | |
| 3 | This API is provided by link:pg-plugin-dev.html#plugin-styles[plugin.styles()] |
| 4 | and provides a way to apply dynamically created styles to elements in a |
| 5 | document. |
| 6 | |
| 7 | [[css]] |
| 8 | == css |
| 9 | `styles.css(rulesStr)` |
| 10 | |
| 11 | .Params |
| 12 | - `*string* rulesStr` string with CSS styling declarations. |
| 13 | |
| 14 | Example: |
| 15 | ---- |
| 16 | const styleObject = plugin.styles().css('background: black; color: white;'); |
| 17 | ... |
| 18 | const className = styleObject.getClassName(element) |
| 19 | ... |
| 20 | element.classList.add(className); |
| 21 | ... |
| 22 | styleObject.apply(someOtherElement); |
| 23 | ---- |
| 24 | |
| 25 | .Returns |
| 26 | - Instance of link:pg-plugin-style-object.html[GrStyleObject]. |
| 27 | |
| 28 | |
| 29 | |