Knockout added future code replaceChildren() for Safari 14+

This commit is contained in:
the-djmaze 2023-03-13 09:03:14 +01:00
parent 4a4b2938a6
commit 2dbf192558
2 changed files with 6 additions and 0 deletions

View file

@ -32,6 +32,9 @@ ko.utils = {
objectForEach: (obj, action) => obj && Object.entries(obj).forEach(prop => action(prop[0], prop[1])),
emptyDomNode: domNode => [...domNode.childNodes].forEach(child => ko.removeNode(child)),
// emptyDomNode: domNode => {while (domNode.lastChild) ko.removeNode(domNode.lastChild)},
// Safari 14+
// emptyDomNode: domNode => domNode.replaceChildren(),
moveCleanedNodesToContainerElement: nodes => {
// Ensure it's a real array, as we're about to reparent the nodes and

View file

@ -4,6 +4,9 @@ ko.utils = {
objectForEach: (obj, action) => obj && Object.entries(obj).forEach(prop => action(prop[0], prop[1])),
emptyDomNode: domNode => [...domNode.childNodes].forEach(child => ko.removeNode(child)),
// emptyDomNode: domNode => {while (domNode.lastChild) ko.removeNode(domNode.lastChild)},
// Safari 14+
// emptyDomNode: domNode => domNode.replaceChildren(),
moveCleanedNodesToContainerElement: nodes => {
// Ensure it's a real array, as we're about to reparent the nodes and