diff options
-rw-r--r-- | src/util/html.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/util/html.js b/src/util/html.js index 0f190e25..9e07f9ba 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -1101,8 +1101,17 @@ export class Attributes { return this.#attributes[attribute]; } - has(attribute) { - return attribute in this.#attributes; + has(attribute, pattern) { + if (typeof pattern === 'undefined') { + return attribute in this.#attributes; + } else if (this.has(attribute)) { + const value = this.get(attribute); + if (Array.isArray(value)) { + return value.includes(pattern); + } else { + return value === pattern; + } + } } remove(attribute) { |