4 <title>:checked pseudo selector not matching selected option
</title>
8 <p>This is a :checked pseudo selector test.
</p>
9 <div id=
"console"></div>
12 <select id='sel' name='select' multiple
>
13 <option id=
"option1" selected
>option1
</option>
14 <option id=
"option2">option2
</option>
15 <option id=
"option3" selected
>option3
</option>
16 <option id=
"option4">option4
</option>
19 <input id=
"radio1" type=
"radio" name=
"radiotest" value=
"radio1" /> Radio1
21 <input id=
"radio2" type=
"radio" name=
"radiotest" value=
"radio2" checked
/> Radio2
23 <input id=
"checkbox1" type=
"checkbox" name=
"checktest" value=
"checkbox1" checked
/> Checkbox1
25 <input id=
"checkbox2" type=
"checkbox" name=
"checktest" value=
"checkbox2" checked
/> Checkbox2
28 <script language=
"JavaScript" type=
"text/javascript">
30 var expectedCount
= 0;
31 var idArray
=new Array("option1","option2","option3","option4","radio1","radio2","checkbox1","checkbox2");
33 if (window
.testRunner
) {
34 testRunner
.dumpAsText();
37 function isCheckedOrSelected(id
) {
38 var obj
= document
.getElementById(id
);
39 if (obj
.checked
|| obj
.selected
)
44 for (var i
= 0; i
< idArray
.length
; i
++) {
45 if (isCheckedOrSelected(idArray
[i
]))
48 totalChecked
= document
.querySelectorAll(':checked').length
;
49 logResult(totalChecked
,expectedCount
);
52 function logResult(totalChecked
, expectedCount
) {
53 if (totalChecked
!= expectedCount
)
54 document
.write('FAIL - expected: ' + expectedCount
+ ' and document.querySelectorAll got: ' + totalChecked
);
56 document
.write('PASS - expected: ' + expectedCount
+ ' and document.querySelectorAll got: ' + totalChecked
);
57 document
.write('<br>');
60 if (window
.eventSender
) {