CssStyleApplier updates (#1784)
* Remove debug log * Remove style attribute if empty * Remove data-* attributes
This commit is contained in:
parent
0c00c56e39
commit
56b2462f13
@ -57,9 +57,6 @@ class CssStyleApplier {
|
|||||||
const {className} = element;
|
const {className} = element;
|
||||||
if (className.length === 0) { continue; }
|
if (className.length === 0) { continue; }
|
||||||
let cssTextNew = '';
|
let cssTextNew = '';
|
||||||
if (className.indexOf('th') >= 0) {
|
|
||||||
console.log(className, this._getRulesForClass(className));
|
|
||||||
}
|
|
||||||
for (const {selectorText, styles} of this._getRulesForClass(className)) {
|
for (const {selectorText, styles} of this._getRulesForClass(className)) {
|
||||||
if (!element.matches(selectorText)) { continue; }
|
if (!element.matches(selectorText)) { continue; }
|
||||||
cssTextNew += this._getCssText(styles);
|
cssTextNew += this._getCssText(styles);
|
||||||
@ -69,7 +66,17 @@ class CssStyleApplier {
|
|||||||
}
|
}
|
||||||
for (const {element, style} of elementStyles) {
|
for (const {element, style} of elementStyles) {
|
||||||
element.removeAttribute('class');
|
element.removeAttribute('class');
|
||||||
|
if (style.length > 0) {
|
||||||
element.setAttribute('style', style);
|
element.setAttribute('style', style);
|
||||||
|
} else {
|
||||||
|
element.removeAttribute('style');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const element of elements) {
|
||||||
|
const {dataset} = element;
|
||||||
|
for (const key of Object.keys(dataset)) {
|
||||||
|
delete dataset[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user