Message from JavaScript discussions
November 2017
— document.createRange().createContextualFragment(tagString);
Then to insert in live DOM
myElement.appendChild(myFragment);
which moves all the child nodes of the fragment into your element, leaving the fragment empty. You can use
myFragment.cloneNode(true);
to do a copy instead of move
— Hope that helps
— Awesome
— Hello.. is there a difference between the createcontextualfragment method and createdocumentfragment methob
— Thank
— Yes
— createContextualFragment
parses a tagString into a DocumentFragment while createDocumentFragment
creates an empty DocumentFragment and doesn't accept a parameter
— See MDN for all this and more:
https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment
https://developer.mozilla.org/en-US/docs/Web/API/Range/createContextualFragment
— Yo guys
— What do you think about this?
https://github.com/XaoticLabs/module.js
— What advantage does it offer over requirejs?
Or ES6 modules alongwith webpack?