mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
LibWeb: Make select element use option's label, not text content
This commit is contained in:
parent
8c4e4ec31b
commit
8f11dfc08a
Notes:
github-actions[bot]
2025-01-04 11:45:06 +00:00
Author: https://github.com/Psychpsyo
Commit: 8f11dfc08a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3130
Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 28 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue