You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow multiple elements in root with Fragments (#118)
* Use hyperx with createFragment support
* Add tests for multiple elements
* Add fragments to lib/browser
* Add fragments to lib/browserify-transform
* Add fragments to lib/babel
* Messed up during rebase
* Add docs for DocumentFragments
Copy file name to clipboardExpand all lines: README.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,21 @@ function onclick (e) {
80
80
}
81
81
```
82
82
83
+
### Multiple root elements
84
+
85
+
If you have more than one root element they will be combined with a [DocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment).
86
+
87
+
```js
88
+
var html =require('nanohtml')
89
+
90
+
var el =html`
91
+
<li>Chashu</li>
92
+
<li>Nori</li>
93
+
`
94
+
95
+
document.querySelector('ul').appendChild(el)
96
+
```
97
+
83
98
## Static optimizations
84
99
Parsing HTML has significant overhead. Being able to parse HTML statically,
85
100
ahead of time can speed up rendering to be about twice as fast.
0 commit comments