|
|
|
@ -6,7 +6,7 @@
|
|
|
|
import { escape_html } from '../../../../../escaping.js';
|
|
|
|
import { escape_html } from '../../../../../escaping.js';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
is_boolean_attribute,
|
|
|
|
is_boolean_attribute,
|
|
|
|
get_dom_property,
|
|
|
|
is_dom_property,
|
|
|
|
is_load_error_element,
|
|
|
|
is_load_error_element,
|
|
|
|
is_void
|
|
|
|
is_void
|
|
|
|
} from '../../../../../utils.js';
|
|
|
|
} from '../../../../../utils.js';
|
|
|
|
@ -557,31 +557,27 @@ function build_element_attribute_update_assignment(element, node_id, attribute,
|
|
|
|
update = b.stmt(b.call('$.set_value', node_id, value));
|
|
|
|
update = b.stmt(b.call('$.set_value', node_id, value));
|
|
|
|
} else if (name === 'checked') {
|
|
|
|
} else if (name === 'checked') {
|
|
|
|
update = b.stmt(b.call('$.set_checked', node_id, value));
|
|
|
|
update = b.stmt(b.call('$.set_checked', node_id, value));
|
|
|
|
|
|
|
|
} else if (is_dom_property(name)) {
|
|
|
|
|
|
|
|
update = b.stmt(b.assignment('=', b.member(node_id, name), value));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const dom_property = get_dom_property(name);
|
|
|
|
if (name === 'style' && attribute.metadata.expression.has_state && has_call) {
|
|
|
|
|
|
|
|
// ensure we're not creating a separate template effect for this so that
|
|
|
|
if (dom_property) {
|
|
|
|
// potential style directives are added to the same effect and therefore always apply
|
|
|
|
update = b.stmt(b.assignment('=', b.member(node_id, dom_property), value));
|
|
|
|
const id = b.id(state.scope.generate('style_derived'));
|
|
|
|
} else {
|
|
|
|
state.init.push(b.const(id, create_derived(state, b.thunk(value))));
|
|
|
|
if (name === 'style' && attribute.metadata.expression.has_state && has_call) {
|
|
|
|
value = b.call('$.get', id);
|
|
|
|
// ensure we're not creating a separate template effect for this so that
|
|
|
|
has_call = false;
|
|
|
|
// potential style directives are added to the same effect and therefore always apply
|
|
|
|
|
|
|
|
const id = b.id(state.scope.generate('style_derived'));
|
|
|
|
|
|
|
|
state.init.push(b.const(id, create_derived(state, b.thunk(value))));
|
|
|
|
|
|
|
|
value = b.call('$.get', id);
|
|
|
|
|
|
|
|
has_call = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const callee = name.startsWith('xlink') ? '$.set_xlink_attribute' : '$.set_attribute';
|
|
|
|
|
|
|
|
update = b.stmt(
|
|
|
|
|
|
|
|
b.call(
|
|
|
|
|
|
|
|
callee,
|
|
|
|
|
|
|
|
node_id,
|
|
|
|
|
|
|
|
b.literal(name),
|
|
|
|
|
|
|
|
value,
|
|
|
|
|
|
|
|
is_ignored(element, 'hydration_attribute_changed') && b.true
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const callee = name.startsWith('xlink') ? '$.set_xlink_attribute' : '$.set_attribute';
|
|
|
|
|
|
|
|
update = b.stmt(
|
|
|
|
|
|
|
|
b.call(
|
|
|
|
|
|
|
|
callee,
|
|
|
|
|
|
|
|
node_id,
|
|
|
|
|
|
|
|
b.literal(name),
|
|
|
|
|
|
|
|
value,
|
|
|
|
|
|
|
|
is_ignored(element, 'hydration_attribute_changed') && b.true
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (attribute.metadata.expression.has_state) {
|
|
|
|
if (attribute.metadata.expression.has_state) {
|
|
|
|
|