mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-20 06:36:16 +00:00
LibWeb: Fix select element state update in three ways
1. We were not propagating selectedness updates from option to select if the option was inside an optgroup. 2. When two or more options were selected, we were always favoring the last one in tree order, instead of the last one that got checked. 3. We were neglecting to return in the `display size is 1` case when all elements were disabled. This was covered by some of the :has() selector tests. :^)
This commit is contained in:
committed by
Andreas Kling
parent
6dad8ea584
commit
6c75a93ec0
@@ -138,8 +138,8 @@ int HTMLOptionElement::index() const
|
||||
void HTMLOptionElement::ask_for_a_reset()
|
||||
{
|
||||
// If an option element in the list of options asks for a reset, then run that select element's selectedness setting algorithm.
|
||||
if (is<HTMLSelectElement>(parent_element())) {
|
||||
static_cast<HTMLSelectElement*>(parent())->update_selectedness();
|
||||
if (auto* select = first_ancestor_of_type<HTMLSelectElement>()) {
|
||||
select->update_selectedness(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user