Use parentNode, parentElement is not supported on IE11

This commit is contained in:
Bruno Windels 2020-08-07 15:07:44 +01:00
parent a7acb0278d
commit a0c8d147c3
2 changed files with 3 additions and 3 deletions

View file

@ -47,7 +47,7 @@ export class SwitchView {
} catch (err) {
newRoot = errorToDOM(err);
}
const parent = oldRoot.parentElement;
const parent = oldRoot.parentNode;
if (parent) {
parent.replaceChild(newRoot, oldRoot);
}

View file

@ -242,8 +242,8 @@ class TemplateBuilder {
if (prevValue !== newValue) {
prevValue = newValue;
const newNode = renderNode(node);
if (node.parentElement) {
node.parentElement.replaceChild(newNode, node);
if (node.parentNode) {
node.parentNode.replaceChild(newNode, node);
}
node = newNode;
}