allow createElement to return DocumentFragment?
See original GitHub issuenanohtml
now supports document fragments, which are very handy for returning a collection of siblings without having to wrap them in an arbitrary element.
However nanocomponent
is not currently designed to handle this.
If we modify the el instanceof window.Element
assert in _handleRender
to also accept window.DocumentFragment
, we encounter an error because nanocomponent is trying to brand the returned node (which isn’t a node).
This also complicates proxying and many other things. I’m not sure how much of a rewrite this would require, but I do think it would be nice to support this feature.
Thoughts?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Inserting arbitrary HTML into a DocumentFragment
Here is a way in modern browsers without looping: var temp = document.createElement('template'); temp.innerHTML = '<div>x</div><span>y</span>'; ...
Read more >DocumentFragment.prepend() - Web APIs | MDN
The DocumentFragment.prepend() method inserts a set of Node objects or string objects before the first child of the document fragment.
Read more >JavaScript innerHTML vs createElement
Summary: in this tutorial, you'll learn the difference between the innerHTML and createElement() when it comes to creating new elements in the DOM...
Read more >Document Fragments and why you should use them
A document fragment is a fragment of a Document Object Model (DOM) tree ... Before going further, let's talk about browser reflow and...
Read more >What is DocumentFragment and createDocumentFragment ...
createDocumentFragment (); let coding = ['PHP','Java','C']; coding.forEach(function(code) { let li = document.createElement('li'); li.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://github.com/hyperdivision/nanomorph-guard https://github.com/hyperdivision/hui
Is one such start.
or choo-hooks 😉