diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-12-29 18:18:30 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-12-30 12:29:51 -0400 |
commit | f3e06dc50d778353bfdc2103bf85e0596e6d71a3 (patch) | |
tree | fca98cdf2097bf443d0ad84f6515007a4fa972fc | |
parent | 64759fd0b49a6d07e70ef116d8b6fdfd1a01a223 (diff) |
html: Attributes.blank
-rw-r--r-- | src/util/html.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/html.js b/src/util/html.js index f01e2d87..6124b35d 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -472,6 +472,16 @@ export class Attributes { return this.#attributes; } + get blank() { + const attributeValues = + Object.values(this.#attributes); + + const keepAnyAttributes = + attributeValues.some(value => this.#keepAttributeValue(value)); + + return !keepAnyAttributes; + } + set(attribute, value) { if (value === null || value === undefined) { this.remove(attribute); |