aboutsummaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-02 18:28:29 -0400
committerGitHub <noreply@github.com>2021-07-02 18:28:29 -0400
commit56b2462f13db5ac9a57bce1b0bc8e18da55d9ce7 (patch)
treeff8b7b55f9bb419be0893b8d9b286d92f8413ab5 /ext/js
parent0c00c56e39a699eac206f66deefaf5a24fec6259 (diff)
CssStyleApplier updates (#1784)
* Remove debug log * Remove style attribute if empty * Remove data-* attributes
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/dom/css-style-applier.js15
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];
+ }
}
}