build_element_attribute_update() — svelte Function Reference
Architecture documentation for the build_element_attribute_update() function in RegularElement.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 065fe64f_1a48_76b9_0518_0c1bcfb5f156["build_element_attribute_update()"] 4610488f_3cf2_5f73_043e_da0aa9d026fe["RegularElement.js"] 065fe64f_1a48_76b9_0518_0c1bcfb5f156 -->|defined in| 4610488f_3cf2_5f73_043e_da0aa9d026fe 1e3b81f2_cd53_e5a5_0140_a9af38facf99["RegularElement()"] 1e3b81f2_cd53_e5a5_0140_a9af38facf99 -->|calls| 065fe64f_1a48_76b9_0518_0c1bcfb5f156 653284b2_68fd_eee3_0064_918a4c065d4a["is_text_attribute()"] 065fe64f_1a48_76b9_0518_0c1bcfb5f156 -->|calls| 653284b2_68fd_eee3_0064_918a4c065d4a b483c37e_f423_950d_2699_2e4d88135b0d["is_dom_property()"] 065fe64f_1a48_76b9_0518_0c1bcfb5f156 -->|calls| b483c37e_f423_950d_2699_2e4d88135b0d 7a7783f8_ffa6_0cc3_61b0_031882649535["is_ignored()"] 065fe64f_1a48_76b9_0518_0c1bcfb5f156 -->|calls| 7a7783f8_ffa6_0cc3_61b0_031882649535 style 065fe64f_1a48_76b9_0518_0c1bcfb5f156 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js lines 646–699
function build_element_attribute_update(element, node_id, name, value, attributes) {
if (name === 'muted') {
// Special case for Firefox who needs it set as a property in order to work
return b.assignment('=', b.member(node_id, b.id('muted')), value);
}
if (name === 'value') {
return b.call('$.set_value', node_id, value);
}
if (name === 'checked') {
return b.call('$.set_checked', node_id, value);
}
if (name === 'selected') {
return b.call('$.set_selected', node_id, value);
}
if (
// If we would just set the defaultValue property, it would override the value property,
// because it is set in the template which implicitly means it's also setting the default value,
// and if one updates the default value while the input is pristine it will also update the
// current value, which is not what we want, which is why we need to do some extra work.
name === 'defaultValue' &&
(attributes.some(
(attr) => attr.type === 'Attribute' && attr.name === 'value' && is_text_attribute(attr)
) ||
(element.name === 'textarea' && element.fragment.nodes.length > 0))
) {
return b.call('$.set_default_value', node_id, value);
}
if (
// See defaultValue comment
name === 'defaultChecked' &&
attributes.some(
(attr) => attr.type === 'Attribute' && attr.name === 'checked' && attr.value === true
)
) {
return b.call('$.set_default_checked', node_id, value);
}
if (is_dom_property(name)) {
return b.assignment('=', b.member(node_id, name), value);
}
return b.call(
name.startsWith('xlink') ? '$.set_xlink_attribute' : '$.set_attribute',
node_id,
b.literal(name),
value,
is_ignored(element, 'hydration_attribute_changed') && b.true
);
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does build_element_attribute_update() do?
build_element_attribute_update() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js.
Where is build_element_attribute_update() defined?
build_element_attribute_update() is defined in packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js at line 646.
What does build_element_attribute_update() call?
build_element_attribute_update() calls 3 function(s): is_dom_property, is_ignored, is_text_attribute.
What calls build_element_attribute_update()?
build_element_attribute_update() is called by 1 function(s): RegularElement.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free