@@ -14,6 +14,7 @@ import map_children from './shared/map_children';
1414import { dimensions } 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' ;
@@ -309,6 +310,22 @@ export default class Element extends Node {
309310 this . optimise ( ) ;
310311
311312 component . apply_stylesheet ( this ) ;
313+
314+ if ( this . parent ) {
315+ if ( this . actions . length > 0 ||
316+ this . animation ||
317+ this . bindings . length > 0 ||
318+ this . classes . length > 0 ||
319+ this . intro || this . outro ||
320+ this . handlers . length > 0 ||
321+ this . styles . length > 0 ||
322+ this . name === 'option' ||
323+ component . compile_options . dev
324+ ) {
325+ this . parent . cannot_use_innerhtml ( ) ; // need to use add_location
326+ this . parent . not_static_content ( ) ;
327+ }
328+ }
312329 }
313330
314331 validate ( ) {
@@ -852,6 +869,18 @@ export default class Element extends Node {
852869 }
853870 } ) ;
854871 }
872+
873+ get can_use_textcontent ( ) {
874+ return this . is_static_content && this . children . every ( node => node . type === 'Text' || node . type === 'MustacheTag' ) ;
875+ }
876+
877+ get can_optimise_to_html_string ( ) {
878+ return ! this . namespace && ( this . can_use_innerhtml || this . can_use_textcontent ) && this . children . length > 0 ;
879+ }
880+
881+ hash ( ) {
882+ return `svelte-${ hash ( this . component . source . slice ( this . start , this . end ) ) } ` ;
883+ }
855884}
856885
857886function should_have_attribute (
0 commit comments