CSSHelper
A static utility class for inserting, deleting, and finding CSS style rules at runtime. It creates and manages a dedicated <style> element in the document head (or a specified parent element) and provides methods to manipulate rules within it.
Note that this class is incompatible with CSP
// Insert a rule dynamically
const rule = CSSHelper.insertRule('.b-sch-event.critical { background-color: red }');
// Later, remove it
CSSHelper.deleteRule(rule);
// Find an existing rule by selector
const existing = CSSHelper.findRule('.b-grid-header');
Useful functions
| Function | Description |
|---|---|
| insertRule | Insert one or more CSS rules |
| findRule | Find a rule by selector string or function |
See also
- DomHelper - DOM element utilities
No results