mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/HTML: Ignore form owner if earlier same-ID element isn't a form
Only set form owner when there is no non-form element with the same ID as the control's form attribute earlier in tree order.
This commit is contained in:
parent
405e270583
commit
a0dbae02c8
Notes:
github-actions[bot]
2025-11-24 08:53:14 +00:00
Author: https://github.com/skyz1
Commit: a0dbae02c8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6914
Reviewed-by: https://github.com/gmta ✅
3 changed files with 341 additions and 3 deletions
|
|
@ -187,9 +187,10 @@ void FormAssociatedElement::reset_form_owner()
|
|||
if (is_listed() && html_element.has_attribute(HTML::AttributeNames::form) && html_element.is_connected()) {
|
||||
// 1. If the first element in element's tree, in tree order, to have an ID that is identical to element's form content attribute's value, is a form element, then associate the element with that form element.
|
||||
auto form_value = html_element.attribute(HTML::AttributeNames::form);
|
||||
html_element.root().for_each_in_inclusive_subtree_of_type<HTMLFormElement>([this, &form_value](HTMLFormElement& form_element) {
|
||||
if (form_element.id() == form_value) {
|
||||
set_form(&form_element);
|
||||
html_element.root().for_each_in_inclusive_subtree_of_type<HTMLElement>([this, &form_value](auto& element) {
|
||||
if (element.id() == form_value) {
|
||||
if (is<HTMLFormElement>(element))
|
||||
set_form(as<HTMLFormElement>(&element));
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue