From 2db78f33ddd734a6c168225529b3c853cd3f04d9 Mon Sep 17 00:00:00 2001 From: Jesse van Assen Date: Mon, 21 Aug 2023 15:29:13 +0200 Subject: [PATCH] Only trigger attributeChangedCallback on toggleAttribute if the value changed --- .../src/scoped-custom-element-registry.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/scoped-custom-element-registry/src/scoped-custom-element-registry.js b/packages/scoped-custom-element-registry/src/scoped-custom-element-registry.js index bbed0154..861a7e13 100644 --- a/packages/scoped-custom-element-registry/src/scoped-custom-element-registry.js +++ b/packages/scoped-custom-element-registry/src/scoped-custom-element-registry.js @@ -354,7 +354,10 @@ if (!ShadowRoot.prototype.createElement) { const old = this.getAttribute(name); toggleAttribute.call(this, name, force); const newValue = this.getAttribute(name); - attributeChangedCallback.call(this, name, old, newValue); + + if (old !== newValue) { + attributeChangedCallback.call(this, name, old, newValue); + } } else { toggleAttribute.call(this, name, force); }