Skip to content

Commit 35d3a9d

Browse files
committed
fix: toggleAttribute polyfill should retain force argument
1 parent a75b94e commit 35d3a9d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/scoped-custom-element-registry/src/scoped-custom-element-registry.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,16 @@ if (!ShadowRoot.prototype.createElement) {
348348
}
349349
const toggleAttribute = elementClass.prototype.toggleAttribute;
350350
if (toggleAttribute) {
351-
elementClass.prototype.toggleAttribute = function (n) {
351+
elementClass.prototype.toggleAttribute = function (n, f) {
352352
const name = n.toLowerCase();
353+
const force = typeof f === 'undefined' ? undefined : !!f
353354
if (observedAttributes.has(name)) {
354355
const old = this.getAttribute(name);
355-
toggleAttribute.call(this, name);
356+
toggleAttribute.call(this, name, force);
356357
const newValue = this.getAttribute(name);
357358
attributeChangedCallback.call(this, name, old, newValue);
358359
} else {
359-
toggleAttribute.call(this, name);
360+
toggleAttribute.call(this, name, force);
360361
}
361362
};
362363
}

0 commit comments

Comments
 (0)