File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
packages/svelte/src/compiler/phases/3-transform/server/visitors Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -130,13 +130,6 @@ export function RegularElement(node, context) {
130130 if ( body === null ) {
131131 process_children ( trimmed , { ...context , state } ) ;
132132 } else {
133- let id = body ;
134-
135- if ( body . type !== 'Identifier' ) {
136- id = b . id ( state . scope . generate ( '$$body' ) ) ;
137- state . template . push ( b . const ( id , body ) ) ;
138- }
139-
140133 // we need the body if:
141134
142135 // - it's a <textarea> or a contenteditable element...we will add it ad the inner template in case the value of value is falsy
@@ -151,12 +144,19 @@ export function RegularElement(node, context) {
151144 state . template . push (
152145 b . stmt (
153146 b . call (
154- id ,
147+ body ,
155148 b . thunk ( b . block ( [ ...inner_state . init , ...build_template ( inner_state . template ) ] ) )
156149 )
157150 )
158151 ) ;
159152 } else {
153+ let id = body ;
154+
155+ if ( body . type !== 'Identifier' ) {
156+ id = b . id ( state . scope . generate ( '$$body' ) ) ;
157+ state . template . push ( b . const ( id , body ) ) ;
158+ }
159+
160160 // Use the body expression as the body if it's truthy, otherwise use the inner template
161161 state . template . push (
162162 b . if (
You can’t perform that action at this time.
0 commit comments