« get me outta code hell

html: Attributes.blank - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
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
commitf3e06dc50d778353bfdc2103bf85e0596e6d71a3 (patch)
treefca98cdf2097bf443d0ad84f6515007a4fa972fc /src/util
parent64759fd0b49a6d07e70ef116d8b6fdfd1a01a223 (diff)
html: Attributes.blank
Diffstat (limited to 'src/util')
-rw-r--r--src/util/html.js10
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);