indeterminate.html (2046B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Selector: pseudo-classes (:indeterminate)</title> 4 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org" id=link1> 5 <link rel=help href="https://html.spec.whatwg.org/multipage/#pseudo-classes" id=link2> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="utils.js"></script> 9 <div id="log"></div> 10 <input type=checkbox id=checkbox1> 11 <input type=checkbox id=checkbox2> 12 <input type=radio id=radio1 checked> 13 <input type=radio name=radiogroup id=radio2> 14 <input type=radio name=radiogroup id=radio3> 15 <input type=radio name=group2 id=radio4> 16 <input type=radio name=group2 id=radio5> 17 <progress id="progress1"></progress> 18 <progress id="progress2" value=10></progress> 19 20 <script> 21 testSelectorIdsMatch(":indeterminate", ["radio2", "radio3", "radio4", "radio5", "progress1"], "':progress' matches <input>s radio buttons whose radio button group contains no checked input and <progress> elements without value attribute"); 22 23 document.getElementById("radio2").setAttribute("checked", "checked"); 24 testSelectorIdsMatch(":indeterminate", ["radio4", "radio5", "progress1"], "dynamically check a radio input in a radio button group"); 25 26 document.getElementById("radio4").click(); 27 testSelectorIdsMatch(":indeterminate", ["progress1"], "click on radio4 which is in the indeterminate state"); 28 29 document.getElementById("progress1").setAttribute("value", "20"); 30 testSelectorIdsMatch(":indeterminate", [], "adding a value to progress1 should put it in a determinate state"); 31 32 document.getElementById("progress2").removeAttribute("value"); 33 testSelectorIdsMatch(":indeterminate", ["progress2"], "removing progress2's value should put it in an indeterminate state"); 34 35 document.getElementById("checkbox1").indeterminate = true; // set checkbox1 in the indeterminate state 36 testSelectorIdsMatch(":indeterminate", ["checkbox1", "progress2"], "':progress' also matches <input> checkbox whose indeterminate IDL is set to true"); 37 </script>