@@ -14,6 +14,7 @@ import map_children from './shared/map_children';
1414import { dimensions , start_newline } from '../../utils/patterns' ;
1515import fuzzymatch from '../../utils/fuzzymatch' ;
1616import list from '../../utils/list' ;
17+ import hash from '../utils/hash' ;
1718import Let from './Let' ;
1819import TemplateScope from './shared/TemplateScope' ;
1920import { INode } from './interfaces' ;
@@ -341,6 +342,23 @@ export default class Element extends Node {
341342 this . optimise ( ) ;
342343
343344 component . apply_stylesheet ( this ) ;
345+
346+ if ( this . parent ) {
347+ if ( this . actions . length > 0 ||
348+ this . animation ||
349+ this . bindings . length > 0 ||
350+ this . classes . length > 0 ||
351+ this . intro || this . outro ||
352+ this . handlers . length > 0 ||
353+ this . styles . length > 0 ||
354+ this . name === 'option' ||
355+ this . tag_expr . dynamic_dependencies ( ) . length ||
356+ component . compile_options . dev
357+ ) {
358+ this . parent . cannot_use_innerhtml ( ) ; // need to use add_location
359+ this . parent . not_static_content ( ) ;
360+ }
361+ }
344362 }
345363
346364 validate ( ) {
@@ -884,6 +902,18 @@ export default class Element extends Node {
884902 }
885903 } ) ;
886904 }
905+
906+ get can_use_textcontent ( ) {
907+ return this . is_static_content && this . children . every ( node => node . type === 'Text' || node . type === 'MustacheTag' ) ;
908+ }
909+
910+ get can_optimise_to_html_string ( ) {
911+ return ! this . namespace && ( this . can_use_innerhtml || this . can_use_textcontent ) && this . children . length > 0 ;
912+ }
913+
914+ hash ( ) {
915+ return `svelte-${ hash ( this . component . source . slice ( this . start , this . end ) ) } ` ;
916+ }
887917}
888918
889919function should_have_attribute (
0 commit comments