mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1558793 - Remove invalid comment and assertion in nsHtml5TreeOperation::SetFormElement; r=hsivonen
Per https://html.spec.whatwg.org/#form-associated-element, img is a form-associated element, and we do handle the img case well. Differential Revision: https://phabricator.services.mozilla.com/D125754
This commit is contained in:
parent
8b189f8ce2
commit
eeb0629c16
@ -639,22 +639,16 @@ nsIContent* nsHtml5TreeOperation::CreateMathMLElement(
|
||||
|
||||
void nsHtml5TreeOperation::SetFormElement(nsIContent* aNode,
|
||||
nsIContent* aParent) {
|
||||
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode));
|
||||
RefPtr<dom::HTMLImageElement> domImageElement =
|
||||
dom::HTMLImageElement::FromNodeOrNull(aNode);
|
||||
// NS_ASSERTION(formControl, "Form-associated element did not implement
|
||||
// nsIFormControl.");
|
||||
// TODO: uncomment the above line when img doesn't cause an issue (bug
|
||||
// 1558793)
|
||||
RefPtr<dom::HTMLFormElement> formElement =
|
||||
dom::HTMLFormElement::FromNodeOrNull(aParent);
|
||||
NS_ASSERTION(formElement,
|
||||
"The form element doesn't implement HTMLFormElement.");
|
||||
// Avoid crashing on <img>
|
||||
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode));
|
||||
if (formControl &&
|
||||
!aNode->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::form)) {
|
||||
formControl->SetForm(formElement);
|
||||
} else if (domImageElement) {
|
||||
} else if (HTMLImageElement* domImageElement =
|
||||
dom::HTMLImageElement::FromNodeOrNull(aNode)) {
|
||||
domImageElement->SetForm(formElement);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user