fix(ui): safe guard for .applyChanges, fixes #1511

This commit is contained in:
nick-delirium 2023-10-13 12:43:04 +02:00
parent fa01014d7a
commit 2bafb358c5

View file

@ -1,6 +1,10 @@
import { insertRule, deleteRule } from './safeCSSRules';
import { isRootNode } from 'App/player/guards'
function isNode(sth: any): sth is Node {
return !!sth && sth.nodeType != null
}
type Callback<T> = (o: T) => void
/**
@ -100,7 +104,9 @@ abstract class VParent<T extends Node = Node> extends VNode<T>{
const realChildren = node.childNodes
for(let j = 0; j < this.children.length; j++) {
while (realChildren[j] !== this.children[j].node) {
node.removeChild(realChildren[j])
if (isNode(realChildren[j])) {
node.removeChild(realChildren[j])
}
}
}
/* Removing tail */