@@ -138,7 +138,7 @@ export function attributes(attrs, css_hash, classes, styles, flags = 0) {
138138 const lowercase = ( flags & ELEMENT_PRESERVE_ATTRIBUTE_CASE ) === 0 ;
139139 const is_input = ( flags & ELEMENT_IS_INPUT ) !== 0 ;
140140
141- for ( name in attrs ) {
141+ for ( name of Object . keys ( attrs ) ) {
142142 // omit functions, internal svelte properties and invalid attribute names
143143 if ( typeof attrs [ name ] === 'function' ) continue ;
144144 if ( name [ 0 ] === '$' && name [ 1 ] === '$' ) continue ; // faster than name.startsWith('$$')
@@ -174,7 +174,8 @@ export function spread_props(props) {
174174
175175 for ( let i = 0 ; i < props . length ; i ++ ) {
176176 const obj = props [ i ] ;
177- for ( key in obj ) {
177+ if ( obj == null ) continue ;
178+ for ( key of Object . keys ( obj ) ) {
178179 const desc = Object . getOwnPropertyDescriptor ( obj , key ) ;
179180 if ( desc ) {
180181 Object . defineProperty ( merged_props , key , desc ) ;
@@ -302,7 +303,7 @@ export function update_store_pre(store_values, store_name, store, d = 1) {
302303
303304/** @param {Record<string, [any, any, any]> } store_values */
304305export function unsubscribe_stores ( store_values ) {
305- for ( const store_name in store_values ) {
306+ for ( const store_name of Object . keys ( store_values ) ) {
306307 store_values [ store_name ] [ 1 ] ( ) ;
307308 }
308309}
@@ -338,7 +339,7 @@ export function rest_props(props, rest) {
338339 /** @type {Record<string, unknown> } */
339340 const rest_props = { } ;
340341 let key ;
341- for ( key in props ) {
342+ for ( key of Object . keys ( props ) ) {
342343 if ( ! rest . includes ( key ) ) {
343344 rest_props [ key ] = props [ key ] ;
344345 }
@@ -363,7 +364,7 @@ export function sanitize_slots(props) {
363364 /** @type {Record<string, boolean> } */
364365 const sanitized = { } ;
365366 if ( props . children ) sanitized . default = true ;
366- for ( const key in props . $$slots ) {
367+ for ( const key of Object . keys ( props . $$slots || { } ) ) {
367368 sanitized [ key ] = true ;
368369 }
369370 return sanitized ;
@@ -376,7 +377,7 @@ export function sanitize_slots(props) {
376377 * @param {Record<string, unknown> } props_now
377378 */
378379export function bind_props ( props_parent , props_now ) {
379- for ( const key in props_now ) {
380+ for ( const key of Object . keys ( props_now ) ) {
380381 const initial_value = props_parent [ key ] ;
381382 const value = props_now [ key ] ;
382383 if (
0 commit comments