Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better implementation in ko.utils.setDomNodeChildren #2611

Open
fengtomy opened this issue Apr 18, 2024 · 0 comments
Open

better implementation in ko.utils.setDomNodeChildren #2611

fengtomy opened this issue Apr 18, 2024 · 0 comments

Comments

@fengtomy
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant