[parser] Associate image elements with form only if the form and the intended parent are in the same tree.

This commit is contained in:
Moonchild committed 2026-07-24 21:12:04 +02:00
1 parent d0b61d4a68
commit 257c64567e
1 file changed
+3
+3
View File
@@ -690,6 +690,9 @@ nsHtml5TreeOperation::CreateMathMLElement(nsIAtom* aName,
void void
nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent) nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent)
{ {
if (aNode->SubtreeRoot() != aParent->SubtreeRoot()) {
return;
}
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode)); nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode));
nsCOMPtr<nsIDOMHTMLImageElement> domImageElement = do_QueryInterface(aNode); nsCOMPtr<nsIDOMHTMLImageElement> domImageElement = do_QueryInterface(aNode);
// NS_ASSERTION(formControl, "Form-associated element did not implement nsIFormControl."); // NS_ASSERTION(formControl, "Form-associated element did not implement nsIFormControl.");