From 0bd8cb73dbd93e10ad748d9b75651533fe8920a0 Mon Sep 17 00:00:00 2001 From: Edoardo Cavazza Date: Thu, 16 Nov 2023 12:35:27 +0100 Subject: [PATCH] Fix `insertAdjacentElement` method. --- .changeset/stale-clocks-shake.md | 5 +++++ docs/index.md | 2 +- src/Element.js | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .changeset/stale-clocks-shake.md diff --git a/.changeset/stale-clocks-shake.md b/.changeset/stale-clocks-shake.md new file mode 100644 index 0000000..b684fbc --- /dev/null +++ b/.changeset/stale-clocks-shake.md @@ -0,0 +1,5 @@ +--- +'@chialab/quantum': patch +--- + +Fix `insertAdjacentElement` method. diff --git a/docs/index.md b/docs/index.md index 0ce0a0e..b6c0435 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,7 +8,7 @@ titleTemplate: Custom elements composition made easy hero: name: 'Quantum' text: '' - tagline: 'Custom elements composition made easy' + tagline: 'Custom elements composition made easy.' actions: - theme: brand text: npm i @chialab/quantum diff --git a/src/Element.js b/src/Element.js index 49dfb8f..17d9e68 100644 --- a/src/Element.js +++ b/src/Element.js @@ -223,7 +223,7 @@ export function extendElement(Element) { switch (position) { case 'beforebegin': if (!parentRealm) { - return /** @type {import('./utils.js').ValueDescriptor} */ (insertAdjacentElement).value.apply( + return /** @type {import('./utils.js').ValueDescriptor} */ (insertAdjacentElement).value.call( this, position, node @@ -232,7 +232,7 @@ export function extendElement(Element) { return parentRealm.insertBefore(this, node); case 'afterend': if (!parentRealm) { - return /** @type {import('./utils.js').ValueDescriptor} */ (insertAdjacentElement).value.apply( + return /** @type {import('./utils.js').ValueDescriptor} */ (insertAdjacentElement).value.call( this, position, node @@ -241,7 +241,7 @@ export function extendElement(Element) { return parentRealm.insertBefore(this.nextSibling, node); case 'afterbegin': if (!realm) { - return /** @type {import('./utils.js').ValueDescriptor} */ (insertAdjacentElement).value.apply( + return /** @type {import('./utils.js').ValueDescriptor} */ (insertAdjacentElement).value.call( this, position, node @@ -250,7 +250,7 @@ export function extendElement(Element) { return realm.prepend(node); case 'beforeend': if (!realm) { - return /** @type {import('./utils.js').ValueDescriptor} */ (insertAdjacentElement).value.apply( + return /** @type {import('./utils.js').ValueDescriptor} */ (insertAdjacentElement).value.call( this, position, node