@@ -161,18 +161,16 @@ export function RegularElement(node, context) {
161
161
162
162
if (
163
163
node . name === 'input' &&
164
- node . attributes . some ( ( attribute ) => {
165
- return (
166
- attribute . type === 'SpreadAttribute' ||
167
- ( attribute . type === 'Attribute' &&
164
+ ( has_spread ||
165
+ bindings . has ( 'value' ) ||
166
+ bindings . has ( 'checked' ) ||
167
+ bindings . has ( 'group' ) ||
168
+ attributes . some (
169
+ ( attribute ) =>
170
+ attribute . type === 'Attribute' &&
168
171
( attribute . name === 'value' || attribute . name === 'checked' ) &&
169
- ! is_text_attribute ( attribute ) ) ||
170
- ( attribute . type === 'BindDirective' &&
171
- ( attribute . name === 'group' ||
172
- attribute . name === 'checked' ||
173
- attribute . name === 'value' ) )
174
- ) ;
175
- } )
172
+ ! is_text_attribute ( attribute )
173
+ ) )
176
174
) {
177
175
context . state . init . push ( b . stmt ( b . call ( '$.remove_input_defaults' , context . state . node ) ) ) ;
178
176
}
@@ -190,11 +188,11 @@ export function RegularElement(node, context) {
190
188
setup_select_synchronization ( /** @type {AST.BindDirective } */ ( bindings . get ( 'value' ) ) , context ) ;
191
189
}
192
190
193
- const node_id = context . state . node ;
194
-
195
191
// Let bindings first, they can be used on attributes
196
192
context . state . init . push ( ...lets ) ;
197
193
194
+ const node_id = context . state . node ;
195
+
198
196
// Then do attributes
199
197
let is_attributes_reactive = false ;
200
198
if ( node . metadata . has_spread ) {
@@ -253,11 +251,6 @@ export function RegularElement(node, context) {
253
251
}
254
252
}
255
253
256
- // Apply the src and loading attributes for <img> elements after the element is appended to the document
257
- if ( node . name === 'img' && ( has_spread || lookup . has ( 'loading' ) ) ) {
258
- context . state . after_update . push ( b . stmt ( b . call ( '$.handle_lazy_img' , node_id ) ) ) ;
259
- }
260
-
261
254
// class/style directives must be applied last since they could override class/style attributes
262
255
build_class_directives ( class_directives , node_id , context , is_attributes_reactive ) ;
263
256
build_style_directives (
@@ -268,6 +261,11 @@ export function RegularElement(node, context) {
268
261
lookup . has ( 'style' ) || node . metadata . has_spread
269
262
) ;
270
263
264
+ // Apply the src and loading attributes for <img> elements after the element is appended to the document
265
+ if ( node . name === 'img' && ( has_spread || lookup . has ( 'loading' ) ) ) {
266
+ context . state . after_update . push ( b . stmt ( b . call ( '$.handle_lazy_img' , node_id ) ) ) ;
267
+ }
268
+
271
269
if (
272
270
is_load_error_element ( node . name ) &&
273
271
( has_spread || has_use || lookup . has ( 'onload' ) || lookup . has ( 'onerror' ) )
0 commit comments