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(
53
53
isHydrating ,
54
54
refQueue
55
55
) {
56
+ if (
57
+ parentDom instanceof DocumentFragment &&
58
+ newParentVNode . type === 'template' &&
59
+ excessDomChildren ?. length === 0
60
+ ) {
61
+ excessDomChildren = Array . from ( parentDom . childNodes ) ;
62
+ }
56
63
let i ,
57
64
/** @type {VNode } */
58
65
oldVNode ,
Original file line number Diff line number Diff line change @@ -2013,4 +2013,11 @@ describe('render()', () => {
2013
2013
render ( < App /> , scratch ) ;
2014
2014
expect ( scratch . innerHTML ) . to . equal ( 'hello world' ) ;
2015
2015
} ) ;
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
+ } ) ;
2016
2023
} ) ;
You can’t perform that action at this time.
0 commit comments