From 0dceb2c28111e37ba997aaa809655ab5ebd06632 Mon Sep 17 00:00:00 2001 From: Aria Stewart Date: Mon, 8 Jun 2020 11:30:37 -0400 Subject: [PATCH] work around Edge issue when removing attributes during hydration (#4911) --- src/runtime/internal/dom.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/runtime/internal/dom.ts b/src/runtime/internal/dom.ts index f67fd13b2d..08e82c0e56 100644 --- a/src/runtime/internal/dom.ts +++ b/src/runtime/internal/dom.ts @@ -155,14 +155,16 @@ export function claim_element(nodes, name, attributes, svg) { const node = nodes[i]; if (node.nodeName === name) { let j = 0; + const remove = []; while (j < node.attributes.length) { - const attribute = node.attributes[j]; - if (attributes[attribute.name]) { - j++; - } else { - node.removeAttribute(attribute.name); + const attribute = node.attributes[j++]; + if (!attributes[attribute.name]) { + remove.push(attribute.name); } } + for (let k = 0; k < remove.length; k++) { + node.removeAttribute(remove[k]); + } return nodes.splice(i, 1)[0]; } }