Explorar o código

Fix deep morphdom key bug (#4423)

Caleb Porzio hai 8 meses
pai
achega
8f4e57b0bd
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      packages/morph/src/morph.js

+ 3 - 0
packages/morph/src/morph.js

@@ -147,6 +147,7 @@ export function morph(from, toHtml, options) {
                     from.appendChild(holdover)
 
                     currentFrom = holdover
+                    fromKey = getKey(currentFrom)
                 } else {
                     if(! shouldSkip(adding, currentTo)) {
                         // Add element...
@@ -256,6 +257,7 @@ export function morph(from, toHtml, options) {
                         // No "from" key...
                         currentFrom.replaceWith(fromKeys[toKey])
                         currentFrom = fromKeys[toKey]
+                        fromKey = getKey(currentFrom)
                     }
                 }
 
@@ -267,6 +269,7 @@ export function morph(from, toHtml, options) {
                         fromKeyHoldovers[fromKey] = currentFrom
                         currentFrom.replaceWith(fromKeyNode)
                         currentFrom = fromKeyNode
+                        fromKey = getKey(currentFrom)
                     } else {
                         // Swap elements with keys...
                         fromKeyHoldovers[fromKey] = currentFrom; // This ";" needs to be here...