From ccda74695947c56f180c2b5e8df7c2d8f9d615c1 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 15 Jan 2024 00:38:24 +0100 Subject: [PATCH] #1168@trivial: Fixes problem with whitespace before and/or after in DOMTokenList. --- packages/happy-dom/src/dom-token-list/DOMTokenList.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/happy-dom/src/dom-token-list/DOMTokenList.ts b/packages/happy-dom/src/dom-token-list/DOMTokenList.ts index c5d4aa5a9..a36a24102 100644 --- a/packages/happy-dom/src/dom-token-list/DOMTokenList.ts +++ b/packages/happy-dom/src/dom-token-list/DOMTokenList.ts @@ -224,7 +224,7 @@ export default class DOMTokenList implements IDOMTokenList { } // It is possible to make this statement shorter by using Array.from() and Set, but this is faster when comparing using a bench test. const list = []; - for (const item of attr.split(ATTRIBUTE_SPLIT_REGEXP)) { + for (const item of attr.trim().split(ATTRIBUTE_SPLIT_REGEXP)) { if (!list.includes(item)) { list.push(item); }