Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / dom-add-optionelement.html
blob3a13470be899fd3824400a920fa90913d7ab853b
1 <html>
2 <body >
3 Purpose: To test if the both DOM1 and DOM2 versions of the add() method add an option to a dropdown list. You should see three "TEST PASSED" lines below.
4 <br>
5 <form name="my_form">
6 <select name="my_select">
7 <option value="a">a</option>
8 </select>
9 </form>
11 <script>
12 if (window.testRunner)
13 testRunner.dumpAsText();
15 // DOM1
16 document.my_form.my_select.add(new Option("c", "c"));
17 if (document.my_form.my_select.options[1].value == 'c')
19 document.write("DOM1 TEST PASSED");
21 else{
22 document.write("DOM1 TEST FAILED");
24 document.write('<br>');
26 // DOM2
27 document.my_form.my_select.add(new Option("b", "b"), document.my_form.my_select.options[1]);
28 if (document.my_form.my_select.options[1].value == 'b')
30 document.write("DOM2 full TEST PASSED");
32 else{
33 document.write("DOM2 full TEST FAILED");
35 document.write('<br>');
37 document.my_form.my_select.add(new Option("d", "d"), null);
38 if (document.my_form.my_select.options[3].value == 'd')
40 document.write("DOM2 null TEST PASSED");
42 else{
43 document.write("DOM2 null TEST FAILED");
45 </script>
46 </body>
47 </html>