From f3e06dc50d778353bfdc2103bf85e0596e6d71a3 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 29 Dec 2023 18:18:30 -0400 Subject: html: Attributes.blank --- src/util/html.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/util') 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); -- cgit 1.3.0-6-gf8a5