@ -83,8 +83,15 @@ function get_attribute_name(element, attribute, context) {
* @ param { Identifier } element _id
* @ param { ComponentContext } context
* @ param { boolean } is _attributes _reactive
* @ param { boolean } force _check Should be ` true ` if we can 't rely on our cached value, because for example there' s also a ` style ` attribute
* /
function serialize _style _directives ( style _directives , element _id , context , is _attributes _reactive ) {
function serialize _style _directives (
style _directives ,
element _id ,
context ,
is _attributes _reactive ,
force _check
) {
const state = context . state ;
for ( const directive of style _directives ) {
@ -99,7 +106,8 @@ function serialize_style_directives(style_directives, element_id, context, is_at
element _id ,
b . literal ( directive . name ) ,
value ,
/** @type {Expression} */ ( directive . modifiers . includes ( 'important' ) ? b . true : undefined )
/** @type {Expression} */ ( directive . modifiers . includes ( 'important' ) ? b . true : undefined ) ,
force _check ? b . true : undefined
)
) ;
@ -2062,6 +2070,7 @@ export const template_visitors = {
let img _might _be _lazy = false ;
let might _need _event _replaying = false ;
let has _direction _attribute = false ;
let has _style _attribute = false ;
if ( is _custom _element ) {
// cloneNode is faster, but it does not instantiate the underlying class of the
@ -2080,6 +2089,9 @@ export const template_visitors = {
if ( attribute . name === 'dir' ) {
has _direction _attribute = true ;
}
if ( attribute . name === 'style' ) {
has _style _attribute = true ;
}
if (
( attribute . name === 'value' || attribute . name === 'checked' ) &&
! is _text _attribute ( attribute )
@ -2229,7 +2241,13 @@ export const template_visitors = {
// class/style directives must be applied last since they could override class/style attributes
serialize _class _directives ( class _directives , node _id , context , is _attributes _reactive ) ;
serialize _style _directives ( style _directives , node _id , context , is _attributes _reactive ) ;
serialize _style _directives (
style _directives ,
node _id ,
context ,
is _attributes _reactive ,
has _style _attribute || node . metadata . has _spread
) ;
if ( might _need _event _replaying ) {
context . state . after _update . push ( b . stmt ( b . call ( '$.replay_events' , node _id ) ) ) ;
@ -2390,7 +2408,13 @@ export const template_visitors = {
// class/style directives must be applied last since they could override class/style attributes
serialize _class _directives ( class _directives , element _id , inner _context , is _attributes _reactive ) ;
serialize _style _directives ( style _directives , element _id , inner _context , is _attributes _reactive ) ;
serialize _style _directives (
style _directives ,
element _id ,
inner _context ,
is _attributes _reactive ,
true
) ;
const get _tag = b . thunk ( /** @type {Expression} */ ( context . visit ( node . tag ) ) ) ;