Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix form association behavior when a form and a control with form= ar…
…e removed from a document together https://bugs.webkit.org/show_bug.cgi?id=247593 Reviewed by Darin Adler. Fix the bug that a form associated element with form content attribute were not disassociated from its form owner if both elements are removed together in a same subtree. New behavior matches the spec as well as behaviors of Chrome and Firefox: https://html.spec.whatwg.org/multipage/infrastructure.html#html-element-removing-steps https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#reset-the-form-owner * LayoutTests/fast/forms/form-associated-element-removal-with-form-attribute-expected.txt: Added. * LayoutTests/fast/forms/form-associated-element-removal-with-form-attribute.html: Added. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/form-control-form-attribute-expected.txt: Rebaselined. * Source/WebCore/html/FormAssociatedElement.cpp: (WebCore::FormAssociatedElement::removedFromAncestor): Canonical link: https://commits.webkit.org/256620@main
- Loading branch information
Showing
4 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This tests removing an input element with form content attribute from the document. | ||
The input element should be dissociated from the form element. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS input.form is null | ||
PASS form.elements.length is 0 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<div><input form="formOwner"><form id="formOwner"></form></div> | ||
<script src="../../resources/js-test.js"></script> | ||
<script> | ||
description(`This tests removing an input element with form content attribute from the document.<br> | ||
The input element should be dissociated from the form element.`); | ||
owner = document.getElementById('owner'); | ||
input = document.querySelector('input'); | ||
form = document.querySelector('form'); | ||
input.parentNode.remove(); | ||
shouldBeNull('input.form'); | ||
shouldBe('form.elements.length', '0'); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters