fix removing attributes during hydration (#1733)

pull/4288/head
Conduitry 5 years ago
parent 33c3a02ee4
commit 91e0d1b720

@ -152,11 +152,16 @@ export function claim_element(nodes, name, attributes, svg) {
for (let i = 0; i < nodes.length; i += 1) {
const node = nodes[i];
if (node.nodeName === name) {
for (let j = 0; j < node.attributes.length; j += 1) {
let j = 0;
while (j < node.attributes.length) {
const attribute = node.attributes[j];
if (!attributes[attribute.name]) node.removeAttribute(attribute.name);
if (attributes[attribute.name]) {
j++;
} else {
node.removeAttribute(attribute.name);
}
}
return nodes.splice(i, 1)[0]; // TODO strip unwanted attributes
return nodes.splice(i, 1)[0];
}
}

Loading…
Cancel
Save