From 4f0ed502c72d34ad6ad2404db4f9411e47511458 Mon Sep 17 00:00:00 2001 From: Joel Drapper Date: Mon, 1 Apr 2024 19:23:19 +0100 Subject: [PATCH] Only build maps if matching element pair --- dist/morphlex.js | 2 +- src/morphlex.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dist/morphlex.js b/dist/morphlex.js index d670f26..faba8f0 100644 --- a/dist/morphlex.js +++ b/dist/morphlex.js @@ -53,8 +53,8 @@ class Morph { this.#morphNode(pair); } morphInner(pair) { - this.#buildMaps(pair); if (isMatchingElementPair(pair)) { + this.#buildMaps(pair); this.#morphMatchingElementContent(pair); } else { throw new Error("You can only do an inner morph with matching elements."); diff --git a/src/morphlex.ts b/src/morphlex.ts index b09db20..db1ef07 100644 --- a/src/morphlex.ts +++ b/src/morphlex.ts @@ -112,9 +112,8 @@ class Morph { } morphInner(pair: NodeReferencePair): void { - this.#buildMaps(pair); - if (isMatchingElementPair(pair)) { + this.#buildMaps(pair); this.#morphMatchingElementContent(pair); } else { throw new Error("You can only do an inner morph with matching elements.");