1 <p>Test that SELECT is in correct state when handling a DOM modification event for option removing.
</p>
3 <select ><option selected
>1</option><option>2</option></select>
4 <select multiple
><option selected
>1</option><option selected
>2</option></select>
5 <select multiple
></select>
10 testRunner
.dumpAsText();
14 var r
= document
.getElementById('res');
15 r
.innerHTML
= r
.innerHTML
+ "<br>" + msg
;
20 function testResults(expectedArr
)
22 var resultsArr
= new Array(theSelect
.options
.length
);
25 for (i
=0; i
< theSelect
.options
.length
; i
++) {
26 resultsArr
[i
] = theSelect
.options
[i
].selected
;
28 var successString
= "Failed";
30 if (expectedArr
.join() == resultsArr
.join()) {
32 successString
= "Passed";
37 log("<pre> Expected: " + expectedArr
.join() + "<br>" + " Actual: " + resultsArr
.join() + "</pre>");
41 function subtreeModified()
43 testResults([true], theSelect
);
46 function nodeInserted()
48 testResults([false], theSelect
);
52 theSelect
= document
.forms
[0].elements
[0];
53 theSelect
.addEventListener("DOMSubtreeModified", subtreeModified
, true);
54 theSelect
.remove(theSelect
.options
[0]);
56 theSelect
= document
.forms
[0].elements
[1];
57 theSelect
.addEventListener("DOMSubtreeModified", subtreeModified
, true);
58 theSelect
.remove(theSelect
.options
[0]);
60 theSelect
= document
.forms
[0].elements
[2];
61 theSelect
.addEventListener("DOMNodeInserted", nodeInserted
, true);
62 theSelect
.options
.add(new Option("2", "2", false, false), 0);