mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +00:00
LibWeb: Make select element use option's label, not text content
This commit is contained in:
@@ -114,6 +114,13 @@ String HTMLOptionElement::label() const
|
||||
void HTMLOptionElement::set_label(String const& label)
|
||||
{
|
||||
MUST(set_attribute(HTML::AttributeNames::label, label));
|
||||
|
||||
// NOTE: This option's select element may need to show different contents now.
|
||||
if (selected()) {
|
||||
if (auto select_element = first_ancestor_of_type<HTMLSelectElement>()) {
|
||||
select_element->update_inner_text_element({});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-option-text
|
||||
|
||||
Reference in New Issue
Block a user