mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-02 06:04:15 +00:00
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
|
@ -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…
Reference in a new issue