File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,13 @@ export function diffChildren(
5353 isHydrating ,
5454 refQueue
5555) {
56+ if (
57+ parentDom instanceof DocumentFragment &&
58+ newParentVNode . type === 'template' &&
59+ excessDomChildren ?. length === 0
60+ ) {
61+ excessDomChildren = Array . from ( parentDom . childNodes ) ;
62+ }
5663 let i ,
5764 /** @type {VNode } */
5865 oldVNode ,
Original file line number Diff line number Diff line change @@ -2013,4 +2013,11 @@ describe('render()', () => {
20132013 render ( < App /> , scratch ) ;
20142014 expect ( scratch . innerHTML ) . to . equal ( 'hello world' ) ;
20152015 } ) ;
2016+ it ( 'should hydrate <template> tags ' , ( ) => {
2017+ const App = ( ) => < template > < h1 > it works</ h1 > </ template >
2018+ scratch . innerHTML = `<template><h1>it works</h1></template>`
2019+
2020+ render ( < App /> , scratch ) ;
2021+ expect ( scratch . innerHTML ) . to . equal ( `<template><h1>it works</h1></template>` )
2022+ } ) ;
20162023} ) ;
You can’t perform that action at this time.
0 commit comments