LibWeb: Check all elements in same tree to determine labeled control
Previously, when looking for the labeled control of a label element, we were only checking its child elements. The specification says we should check all elements in the same tree as the label element.
This commit is contained in:
parent
fc395716e9
commit
5296338e7a
Notes:
sideshowbarker
2024-07-17 01:28:15 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/5296338e7a Pull-request: https://github.com/SerenityOS/serenity/pull/24346 Reviewed-by: https://github.com/shannonbooth ✅
1 changed files with 1 additions and 1 deletions
|
@ -43,7 +43,7 @@ JS::GCPtr<HTMLElement> HTMLLabelElement::control() const
|
|||
// and the first such element in tree order is a labelable element, then that element is the
|
||||
// label element's labeled control.
|
||||
if (for_().has_value()) {
|
||||
for_each_in_inclusive_subtree_of_type<HTMLElement>([&](auto& element) {
|
||||
root().for_each_in_inclusive_subtree_of_type<HTMLElement>([&](auto& element) {
|
||||
if (element.id() == *for_() && element.is_labelable()) {
|
||||
control = &const_cast<HTMLElement&>(element);
|
||||
return TraversalDecision::Break;
|
||||
|
|
Loading…
Add table
Reference in a new issue