@@ -377,13 +377,15 @@ export default class ElementWrapper extends Wrapper {
377377
378378 const { can_use_textcontent, can_optimise_to_html_string } = this . node ;
379379
380+ const to_optimise_hydration = can_optimise_to_html_string || ( ! is_head ( parent_node ) && this . node . children . length === 1 && this . node . children [ 0 ] . type === 'RawMustacheTag' ) ;
381+
380382 if ( hydratable ) {
381383 if ( parent_nodes ) {
382384 block . chunks . claim . push ( b `
383- ${ node } = ${ this . get_claim_statement ( block , parent_nodes , can_optimise_to_html_string ) } ;
385+ ${ node } = ${ this . get_claim_statement ( block , parent_nodes , to_optimise_hydration ) } ;
384386 ` ) ;
385387
386- if ( ! can_optimise_to_html_string && ! this . void && this . node . children . length > 0 ) {
388+ if ( ! to_optimise_hydration && ! this . void && this . node . children . length > 0 ) {
387389 block . chunks . claim . push ( b `
388390 var ${ nodes } = ${ children } ;
389391 ` ) ;
@@ -492,7 +494,7 @@ export default class ElementWrapper extends Wrapper {
492494 this . add_styles ( block ) ;
493495 this . add_manual_style_scoping ( block ) ;
494496
495- if ( nodes && hydratable && ! this . void && ! can_optimise_to_html_string ) {
497+ if ( nodes && hydratable && ! this . void && ! to_optimise_hydration ) {
496498 block . chunks . claim . push (
497499 b `${ this . node . children . length > 0 ? nodes : children } .forEach(@detach);`
498500 ) ;
@@ -528,7 +530,7 @@ export default class ElementWrapper extends Wrapper {
528530 return x `@element(${ reference } )` ;
529531 }
530532
531- get_claim_statement ( block : Block , nodes : Identifier , can_optimise_to_html_string : boolean ) {
533+ get_claim_statement ( block : Block , nodes : Identifier , to_optimise_hydration : boolean ) {
532534 const attributes = this . attributes
533535 . filter ( ( attr ) => ! ( attr instanceof SpreadAttributeWrapper ) && ! attr . property_name )
534536 . map ( ( attr ) => p `${ ( attr as StyleAttributeWrapper | AttributeWrapper ) . name } : true` ) ;
@@ -546,7 +548,7 @@ export default class ElementWrapper extends Wrapper {
546548 reference = x `(${ this . node . tag_expr . manipulate ( block ) } || 'null').toUpperCase()` ;
547549 }
548550
549- if ( can_optimise_to_html_string ) {
551+ if ( to_optimise_hydration ) {
550552 attributes . push ( p `["data-svelte"]: true` ) ;
551553 }
552554
0 commit comments