@@ -224,15 +224,17 @@ export function set_custom_element_data(node, prop, value) {
224224 set_active_effect ( null ) ;
225225 try {
226226 if (
227+ // style need set_attribute()
228+ prop !== 'style' &&
227229 // Don't compute setters for custom elements while they aren't registered yet,
228230 // because during their upgrade/instantiation they might add more setters.
229231 // Instead, fall back to a simple "an object, then set as property" heuristic.
230- setters_cache . has ( node . nodeName ) ||
232+ ( setters_cache . has ( node . nodeName ) ||
231233 // customElements may not be available in browser extension contexts
232234 ! customElements ||
233235 customElements . get ( node . tagName . toLowerCase ( ) )
234236 ? get_setters ( node ) . includes ( prop )
235- : value && typeof value === 'object'
237+ : value && typeof value === 'object' )
236238 ) {
237239 // @ts -expect-error
238240 node [ prop ] = value ;
@@ -375,8 +377,8 @@ export function set_attributes(
375377 // @ts -ignore
376378 element [ `__${ event_name } ` ] = undefined ;
377379 }
378- } else if ( key === 'style' && value != null ) {
379- element . style . cssText = value + '' ;
380+ } else if ( key === 'style' ) {
381+ set_attribute ( element , key , value ) ;
380382 } else if ( key === 'autofocus' ) {
381383 autofocus ( /** @type {HTMLElement } */ ( element ) , Boolean ( value ) ) ;
382384 } else if ( ! is_custom_element && ( key === '__value' || ( key === 'value' && value != null ) ) ) {
0 commit comments