Skip to content

Commit c478d3e

Browse files
fix: update how polyfill patches customElements.define
1 parent 7b97dc2 commit c478d3e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/element-internals.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ if (!isElementInternalsSupported()) {
313313
/** @ts-expect-error: we need to replace the default ElementInternals */
314314
window.ElementInternals = ElementInternals;
315315

316-
const define = customElements.define;
317-
customElements.define = function (name, constructor, options) {
316+
const define = CustomElementRegistry.prototype.define;
317+
CustomElementRegistry.prototype.define = function (name, constructor, options) {
318318
if (constructor.formAssociated) {
319319
const connectedCallback = constructor.prototype.connectedCallback;
320320
constructor.prototype.connectedCallback = function () {
@@ -332,7 +332,7 @@ if (!isElementInternalsSupported()) {
332332
};
333333
}
334334

335-
define.apply(customElements, [name, constructor, options]);
335+
define.call(this, name, constructor, options);
336336
}
337337

338338
function attachShadowObserver(...args) {

0 commit comments

Comments
 (0)