Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r224398 - Invalidate node list when associated form control ele…
…ment is removed https://bugs.webkit.org/show_bug.cgi?id=179232 <rdar://problem/35308269> Reviewed by Ryosuke Niwa. Source/WebCore: A node list represents a live view of the DOM. Invalidate the node list associated with a form element whenever one of its associated form control elements is removed. Test: fast/forms/node-list-remove-button-from-form.html * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::removeFormElement): LayoutTests: Add a test to ensure the node list returned by HTMLFormElement.elements stays synchronized with the document. * fast/forms/node-list-remove-button-from-form-expected.txt: Added. * fast/forms/node-list-remove-button-from-form.html: Added.
- Loading branch information
1 parent
bcdbd1f
commit f50f36a
Showing
5 changed files
with
77 additions
and
0 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
15 changes: 15 additions & 0 deletions
15
LayoutTests/fast/forms/node-list-remove-button-from-form-expected.txt
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 @@ | ||
Tests that removing a <button> from the document removes it from HTMLFormElement.elements. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
Before removal of button: | ||
PASS document.getElementById('aForm').elements is non-null. | ||
PASS document.getElementById('aForm')['aButton'] is document.getElementById('aButton') | ||
|
||
After removal of button: | ||
PASS document.getElementById('aForm')['aButton'] is undefined. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
28 changes: 28 additions & 0 deletions
28
LayoutTests/fast/forms/node-list-remove-button-from-form.html
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,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<button id="aButton" form="aForm"></button> | ||
<form id="aForm"></form> | ||
<script> | ||
description("Tests that removing a <button> from the document removes it from HTMLFormElement.elements."); | ||
|
||
runTest(); | ||
|
||
function runTest() | ||
{ | ||
debug("Before removal of button:"); | ||
shouldBeNonNull("document.getElementById('aForm').elements"); | ||
shouldBe("document.getElementById('aForm')['aButton']", "document.getElementById('aButton')"); | ||
document.getElementById('aButton').remove(); | ||
|
||
debug("<br>After removal of button:"); | ||
shouldBeUndefined("document.getElementById('aForm')['aButton']"); | ||
} | ||
</script> | ||
</body> | ||
</html> |
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