knockout / knockout

Knockout makes it easier to create rich, responsive UIs with JavaScript
http://knockoutjs.com/
Other
10.43k stars 1.52k forks source link

better implementation in ko.utils.setDomNodeChildren #2611

Open fengtomy opened 2 months ago

fengtomy commented 2 months ago

Recently I need to maintain a konckout.js project. Other day when I was debugging the source code, I found an operation about appending children nodes to a node in ko.utils.setDomNodeChildren.

ko.utils.emptyDomNode(domNode);
            if (childNodes) {
                for (var i = 0, j = childNodes.length; i < j; i++)
                    domNode.appendChild(childNodes[i]);
            }

And I think it's better to create a document fragment, then append that fragment into domNode once. MDN createDocumentFragment
Sorry to bother, and I know it's now stable. If need any help, please contact me.