Prevent CSS stacking when changing themes (#5378)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
c6cd6feabe
Коммит
a2e6553b7f
@@ -711,6 +711,17 @@ export function changeCss(className, classValue) {
|
|||||||
|
|
||||||
// Grab style sheet
|
// Grab style sheet
|
||||||
const styleSheet = styleEl.sheet;
|
const styleSheet = styleEl.sheet;
|
||||||
|
const rules = styleSheet.cssRules || styleSheet.rules;
|
||||||
|
const style = classValue.substr(0, classValue.indexOf(':'));
|
||||||
|
const value = classValue.substr(classValue.indexOf(':') + 1);
|
||||||
|
|
||||||
|
for (let i = 0; i < rules.length; i++) {
|
||||||
|
if (rules[i].selectorText === className) {
|
||||||
|
rules[i].style[style] = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mediaQuery = '';
|
let mediaQuery = '';
|
||||||
if (className.indexOf('@media') >= 0) {
|
if (className.indexOf('@media') >= 0) {
|
||||||
mediaQuery = '}';
|
mediaQuery = '}';
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user