mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb/HTML: Fix behavior when removing multiple from select element
This change ensures correct behavior when the `multiple` attribute is removed from a `select` element, reducing the number of selected `option` elements to one. Fixes a failing WPT test: https://wpt.live/html/semantics/forms/the-select-element/select-multiple.html
This commit is contained in:
parent
937994cfaa
commit
9a071c9e89
|
|
@ -574,6 +574,16 @@ void HTMLSelectElement::form_associated_element_was_inserted()
|
|||
create_shadow_tree_if_needed();
|
||||
}
|
||||
|
||||
void HTMLSelectElement::form_associated_element_attribute_changed(FlyString const& name, Optional<String> const& value, Optional<FlyString> const&)
|
||||
{
|
||||
if (name == HTML::AttributeNames::multiple) {
|
||||
// If the multiple attribute is absent then update the selectedness of the option elements.
|
||||
if (!value.has_value()) {
|
||||
update_selectedness();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLSelectElement::computed_properties_changed()
|
||||
{
|
||||
// Hide chevron icon when appearance is none
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ public:
|
|||
virtual void activation_behavior(DOM::Event const&) override;
|
||||
|
||||
virtual void form_associated_element_was_inserted() override;
|
||||
virtual void form_associated_element_attribute_changed(FlyString const&, Optional<String> const&, Optional<FlyString> const&) override;
|
||||
|
||||
void did_select_item(Optional<u32> const& id);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ Harness status: OK
|
|||
|
||||
Found 3 tests
|
||||
|
||||
2 Pass
|
||||
1 Fail
|
||||
3 Pass
|
||||
Pass multiple selected options exist, both set from markup
|
||||
Pass multiple selected options exist, one set from script
|
||||
Fail Removing multiple attribute reduces the number of selected OPTIONs to 1
|
||||
Pass Removing multiple attribute reduces the number of selected OPTIONs to 1
|
||||
Loading…
Reference in New Issue
Block a user