@@ -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 ` ) ;
@@ -478,7 +480,7 @@ export default class ElementWrapper extends Wrapper {
478480 this . add_styles ( block ) ;
479481 this . add_manual_style_scoping ( block ) ;
480482
481- if ( nodes && hydratable && ! this . void && ! can_optimise_to_html_string ) {
483+ if ( nodes && hydratable && ! this . void && ! to_optimise_hydration ) {
482484 block . chunks . claim . push (
483485 b `${ this . node . children . length > 0 ? nodes : children } .forEach(@detach);`
484486 ) ;
@@ -514,7 +516,7 @@ export default class ElementWrapper extends Wrapper {
514516 return x `@element(${ reference } )` ;
515517 }
516518
517- get_claim_statement ( block : Block , nodes : Identifier , can_optimise_to_html_string : boolean ) {
519+ get_claim_statement ( block : Block , nodes : Identifier , to_optimise_hydration : boolean ) {
518520 const attributes = this . attributes
519521 . filter ( ( attr ) => ! ( attr instanceof SpreadAttributeWrapper ) && ! attr . property_name )
520522 . map ( ( attr ) => p `${ ( attr as StyleAttributeWrapper | AttributeWrapper ) . name } : true` ) ;
@@ -532,7 +534,7 @@ export default class ElementWrapper extends Wrapper {
532534 reference = x `(${ this . node . tag_expr . manipulate ( block ) } || 'null').toUpperCase()` ;
533535 }
534536
535- if ( can_optimise_to_html_string ) {
537+ if ( to_optimise_hydration ) {
536538 attributes . push ( p `["data-svelte"]: true` ) ;
537539 }
538540
0 commit comments