mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
Deselect other options when select option is selected, and it's not a multi-select.
This commit is contained in:
parent
aa380ed47a
commit
4684e9665d
@ -520,7 +520,7 @@ bool form_successful_controls_dom(struct form *_form,
|
|||||||
goto dom_no_memory;
|
goto dom_no_memory;
|
||||||
}
|
}
|
||||||
for(option_index = 0; option_index < options_count;
|
for(option_index = 0; option_index < options_count;
|
||||||
++option_index) {
|
++option_index) {
|
||||||
bool selected;
|
bool selected;
|
||||||
if (option_element != NULL) {
|
if (option_element != NULL) {
|
||||||
dom_node_unref(option_element);
|
dom_node_unref(option_element);
|
||||||
@ -1335,19 +1335,23 @@ static void form__select_process_selection(html_content *html,
|
|||||||
count++, o = o->next) {
|
count++, o = o->next) {
|
||||||
if (!control->data.select.multiple)
|
if (!control->data.select.multiple)
|
||||||
o->selected = false;
|
o->selected = false;
|
||||||
|
dom_html_option_element_set_selected(o->node, false);
|
||||||
if (count == item) {
|
if (count == item) {
|
||||||
if (control->data.select.multiple) {
|
if (control->data.select.multiple) {
|
||||||
if (o->selected) {
|
if (o->selected) {
|
||||||
o->selected = false;
|
o->selected = false;
|
||||||
dom_html_option_element_set_selected(o->node, false);
|
dom_html_option_element_set_selected(
|
||||||
|
o->node, false);
|
||||||
control->data.select.num_selected--;
|
control->data.select.num_selected--;
|
||||||
} else {
|
} else {
|
||||||
o->selected = true;
|
o->selected = true;
|
||||||
dom_html_option_element_set_selected(o->node, true);
|
dom_html_option_element_set_selected(
|
||||||
|
o->node, true);
|
||||||
control->data.select.num_selected++;
|
control->data.select.num_selected++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dom_html_option_element_set_selected(o->node, true);
|
dom_html_option_element_set_selected(
|
||||||
|
o->node, true);
|
||||||
o->selected = true;
|
o->selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user