We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Here's a case when multiple roots throws an error:
var html = require('nanohtml') var nums = [10,20,30] var el = html` <main> <h1>Hello planet</h1> </main> ${nums.map(n => html`<div>${n}</div>` )} ` document.body.appendChild(el)
Updating nanohtml's createFragment to look something like this solves the problem:
createFragment
function createFragment (nodes) { var fragment = document.createDocumentFragment() for (var i = 0; i < nodes.length; i++) { if (typeof nodes[i] === 'string') nodes[i] = document.createTextNode(nodes[i]) if (Array.isArray(nodes[i])) { for (var n=0; n < nodes[i].length; n++) { fragment.appendChild(nodes[i][n]) } } else { fragment.appendChild(nodes[i]) } } return fragment }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Here's a case when multiple roots throws an error:
Updating nanohtml's
createFragment
to look something like this solves the problem:The text was updated successfully, but these errors were encountered: