|
|
|
|
|
by osoba
3377 days ago
|
|
Wouldn't these two lines of code do the same thing? var addCSS = (css) => { window.document.styleSheets[0].insertRule(css, window.document.styleSheets[0].cssRules.length); };
addCSS('.x { color: red; width: 5px; }');
Test examples (+ another version that can add multiple selectors in the same line): https://jsfiddle.net/xkLnj9st/ |
|