@@ -363,13 +363,15 @@ export default class ElementWrapper extends Wrapper {
363363
364364 const { can_use_textcontent, can_optimise_to_html_string } = this . node ;
365365
366+ const to_optimise_hydration = can_optimise_to_html_string || ( ! is_head ( parent_node ) && this . node . children . length === 1 && this . node . children [ 0 ] . type === 'RawMustacheTag' ) ;
367+
366368 if ( hydratable ) {
367369 if ( parent_nodes ) {
368370 block . chunks . claim . push ( b `
369- ${ node } = ${ this . get_claim_statement ( block , parent_nodes , can_optimise_to_html_string ) } ;
371+ ${ node } = ${ this . get_claim_statement ( block , parent_nodes , to_optimise_hydration ) } ;
370372 ` ) ;
371373
372- if ( ! can_optimise_to_html_string && ! this . void && this . node . children . length > 0 ) {
374+ if ( ! to_optimise_hydration && ! this . void && this . node . children . length > 0 ) {
373375 block . chunks . claim . push ( b `
374376 var ${ nodes } = ${ children } ;
375377 ` ) ;
@@ -477,7 +479,7 @@ export default class ElementWrapper extends Wrapper {
477479 this . add_styles ( block ) ;
478480 this . add_manual_style_scoping ( block ) ;
479481
480- if ( nodes && hydratable && ! this . void && ! can_optimise_to_html_string ) {
482+ if ( nodes && hydratable && ! this . void && ! to_optimise_hydration ) {
481483 block . chunks . claim . push (
482484 b `${ this . node . children . length > 0 ? nodes : children } .forEach(@detach);`
483485 ) ;
@@ -513,7 +515,7 @@ export default class ElementWrapper extends Wrapper {
513515 return x `@element(${ reference } )` ;
514516 }
515517
516- get_claim_statement ( block : Block , nodes : Identifier , can_optimise_to_html_string : boolean ) {
518+ get_claim_statement ( block : Block , nodes : Identifier , to_optimise_hydration : boolean ) {
517519 const attributes = this . attributes
518520 . filter ( ( attr ) => ! ( attr instanceof SpreadAttributeWrapper ) && ! attr . property_name )
519521 . map ( ( attr ) => p `${ ( attr as StyleAttributeWrapper | AttributeWrapper ) . name } : true` ) ;
@@ -531,7 +533,7 @@ export default class ElementWrapper extends Wrapper {
531533 reference = x `(${ this . node . tag_expr . manipulate ( block ) } || 'null').toUpperCase()` ;
532534 }
533535
534- if ( can_optimise_to_html_string ) {
536+ if ( to_optimise_hydration ) {
535537 attributes . push ( p `["data-svelte"]: true` ) ;
536538 }
537539
0 commit comments