diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-07-02 18:28:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-02 18:28:29 -0400 |
commit | 56b2462f13db5ac9a57bce1b0bc8e18da55d9ce7 (patch) | |
tree | ff8b7b55f9bb419be0893b8d9b286d92f8413ab5 | |
parent | 0c00c56e39a699eac206f66deefaf5a24fec6259 (diff) |
CssStyleApplier updates (#1784)
* Remove debug log
* Remove style attribute if empty
* Remove data-* attributes
-rw-r--r-- | ext/js/dom/css-style-applier.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ext/js/dom/css-style-applier.js b/ext/js/dom/css-style-applier.js index 6de4bd2d..32d7ef0f 100644 --- a/ext/js/dom/css-style-applier.js +++ b/ext/js/dom/css-style-applier.js @@ -57,9 +57,6 @@ class CssStyleApplier { const {className} = element; if (className.length === 0) { continue; } let cssTextNew = ''; - if (className.indexOf('th') >= 0) { - console.log(className, this._getRulesForClass(className)); - } for (const {selectorText, styles} of this._getRulesForClass(className)) { if (!element.matches(selectorText)) { continue; } cssTextNew += this._getCssText(styles); @@ -69,7 +66,17 @@ class CssStyleApplier { } for (const {element, style} of elementStyles) { element.removeAttribute('class'); - element.setAttribute('style', style); + if (style.length > 0) { + 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]; + } } } |