ko.utils.domNodeDisposal.addDisposeCallback to ko.addDisposeCallback

This commit is contained in:
the-djmaze 2024-10-29 22:19:26 +01:00
parent c744b83480
commit 4cd5774257
12 changed files with 111 additions and 113 deletions

View file

@ -76,17 +76,15 @@
ko.utils.setDomNodeChildren(node, childNodes);
},
prepend: (containerNode, nodeToPrepend) => {
// Start comments must always have a parent and at least one following sibling (the end comment)
isStartComment(containerNode)
? containerNode.nextSibling.before(nodeToPrepend)
: containerNode.prepend(nodeToPrepend);
},
insertAfter: (containerNode, nodeToInsert, insertAfterNode) => {
insertAfterNode
? insertAfterNode.after(nodeToInsert)
: ko.virtualElements.prepend(containerNode, nodeToInsert);
: (
// Start comments must always have a parent and at least one following sibling (the end comment)
isStartComment(containerNode)
? containerNode.nextSibling.before(nodeToInsert)
: containerNode.prepend(nodeToInsert)
);
},
firstChild: node => {