select_option() — svelte Function Reference
Architecture documentation for the select_option() function in select.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 35049132_3e86_afd7_a475_924b092a0c2b["select_option()"] dbe1ea86_6e94_eeeb_a2d1_1db78ca967bc["select.js"] 35049132_3e86_afd7_a475_924b092a0c2b -->|defined in| dbe1ea86_6e94_eeeb_a2d1_1db78ca967bc 9a87a496_4e7d_9214_8bba_7bb2e3e47939["attribute_effect()"] 9a87a496_4e7d_9214_8bba_7bb2e3e47939 -->|calls| 35049132_3e86_afd7_a475_924b092a0c2b 69a43253_5c15_5f06_b28b_0c8b251c8edd["init_select()"] 69a43253_5c15_5f06_b28b_0c8b251c8edd -->|calls| 35049132_3e86_afd7_a475_924b092a0c2b c085d4db_2942_3c89_a472_21c20593b124["bind_select_value()"] c085d4db_2942_3c89_a472_21c20593b124 -->|calls| 35049132_3e86_afd7_a475_924b092a0c2b a9ac72f8_940e_3439_6f47_f1427cd0c587["select_multiple_invalid_value()"] 35049132_3e86_afd7_a475_924b092a0c2b -->|calls| a9ac72f8_940e_3439_6f47_f1427cd0c587 92afbc52_412a_6f4e_4097_d55790325b3e["get_option_value()"] 35049132_3e86_afd7_a475_924b092a0c2b -->|calls| 92afbc52_412a_6f4e_4097_d55790325b3e e604925d_22aa_7ddd_2399_07b188b31eb1["is()"] 35049132_3e86_afd7_a475_924b092a0c2b -->|calls| e604925d_22aa_7ddd_2399_07b188b31eb1 style 35049132_3e86_afd7_a475_924b092a0c2b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/internal/client/dom/elements/bindings/select.js lines 15–46
export function select_option(select, value, mounting = false) {
if (select.multiple) {
// If value is null or undefined, keep the selection as is
if (value == undefined) {
return;
}
// If not an array, warn and keep the selection as is
if (!is_array(value)) {
return w.select_multiple_invalid_value();
}
// Otherwise, update the selection
for (var option of select.options) {
option.selected = value.includes(get_option_value(option));
}
return;
}
for (option of select.options) {
var option_value = get_option_value(option);
if (is(option_value, value)) {
option.selected = true;
return;
}
}
if (!mounting || value !== undefined) {
select.selectedIndex = -1; // no option should be selected
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does select_option() do?
select_option() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/dom/elements/bindings/select.js.
Where is select_option() defined?
select_option() is defined in packages/svelte/src/internal/client/dom/elements/bindings/select.js at line 15.
What does select_option() call?
select_option() calls 3 function(s): get_option_value, is, select_multiple_invalid_value.
What calls select_option()?
select_option() is called by 3 function(s): attribute_effect, bind_select_value, init_select.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free