question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

allow createElement to return DocumentFragment?

See original GitHub issue

nanohtml 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:open
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

0reactions
s3ththompsoncommented, Apr 25, 2019

or choo-hooks 😉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found