Invalidate node list when associated form control element is removed
[WebKit.git] / LayoutTests / fast / forms / node-list-remove-button-from-form.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <button id="aButton" form="aForm"></button>
10 <form id="aForm"></form>
11 <script>
12 description("Tests that removing a &lt;button&gt; from the document removes it from HTMLFormElement.elements.");
13
14 runTest();
15
16 function runTest()
17 {
18     debug("Before removal of button:");
19     shouldBeNonNull("document.getElementById('aForm').elements");
20     shouldBe("document.getElementById('aForm')['aButton']", "document.getElementById('aButton')");
21     document.getElementById('aButton').remove();
22
23     debug("<br>After removal of button:");
24     shouldBeUndefined("document.getElementById('aForm')['aButton']");
25 }
26 </script>
27 </body>
28 </html>