work around Edge issue when removing attributes during hydration (#4911)

pull/4994/head
Aria Stewart 5 years ago committed by GitHub
parent 430961cc94
commit 0dceb2c281
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -155,14 +155,16 @@ export function claim_element(nodes, name, attributes, svg) {
const node = nodes[i]; const node = nodes[i];
if (node.nodeName === name) { if (node.nodeName === name) {
let j = 0; let j = 0;
const remove = [];
while (j < node.attributes.length) { while (j < node.attributes.length) {
const attribute = node.attributes[j]; const attribute = node.attributes[j++];
if (attributes[attribute.name]) { if (!attributes[attribute.name]) {
j++; remove.push(attribute.name);
} else {
node.removeAttribute(attribute.name);
} }
} }
for (let k = 0; k < remove.length; k++) {
node.removeAttribute(remove[k]);
}
return nodes.splice(i, 1)[0]; return nodes.splice(i, 1)[0];
} }
} }

Loading…
Cancel
Save