| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>required and basic valueMissing</title> | |
| 5 <script src="../../resources/js-test.js"></script> | |
| 6 </head> | |
| 7 <body> | |
| 8 <p id="description"></p> | |
| 9 <div id="console"></div> | |
| 10 <input id="input" name="victim" required/> | |
| 11 <textarea id="textarea" name="victim" required></textarea> | |
| 12 <select id="select-no-option" name="victim" required> | |
| 13 </select> | |
| 14 <select id="select-placeholder-selected" name="victim" required> | |
| 15 <option value="" selected /> | |
| 16 <option value="X">X</option> | |
| 17 </select> | |
| 18 <select id="select-without-placeholder" name="victim" required> | |
| 19 <option value="X">X</option> | |
| 20 <option value="" selected /> | |
| 21 </select> | |
| 22 <select id="select-placeholder-selected-size2" name="victim" size="2" required> | |
| 23 <option value="" selected /> | |
| 24 <option value="X">X</option> | |
| 25 </select> | |
| 26 <select id="select-without-placeholder-size2" name="victim" size="2" required> | |
| 27 <option value="X">X</option> | |
| 28 <option value="" selected /> | |
| 29 </select> | |
| 30 <select id="select-none-selected-multiple" name="victim" multiple required> | |
| 31 <option value="" /> | |
| 32 <option value="X">X</option> | |
| 33 </select> | |
| 34 <select id="select-fake-placeholder-selected-multiple" name="victim" multiple re
quired> | |
| 35 <option value="" selected /> | |
| 36 <option value="X">X</option> | |
| 37 </select> | |
| 38 <select id="select-without-fake-placeholder-multiple" name="victim" multiple req
uired> | |
| 39 <option value="X">X</option> | |
| 40 <option value="" selected /> | |
| 41 </select> | |
| 42 <select id="select-none-selected-size2-multiple" name="victim" multiple size="2"
required> | |
| 43 <option value="" /> | |
| 44 <option value="X">X</option> | |
| 45 </select> | |
| 46 <select id="select-fake-placeholder-selected-size2-multiple" name="victim" multi
ple size="2" required> | |
| 47 <option value="" selected /> | |
| 48 <option value="X">X</option> | |
| 49 </select> | |
| 50 <select id="select-without-fake-placeholder-size2-multiple" name="victim" multip
le size="2" required> | |
| 51 <option value="X">X</option> | |
| 52 <option value="" selected /> | |
| 53 </select> | |
| 54 <select id="select-optgroup" name="victim" required> | |
| 55 <optgroup label="1"> | |
| 56 <option value="" selected /> | |
| 57 </optgroup> | |
| 58 <option value="X">X</option> | |
| 59 </select> | |
| 60 <select id="select-disabled-option" name="victim" required> | |
| 61 <option value="" disabled selected /> | |
| 62 <option value="X">X</option> | |
| 63 </select> | |
| 64 <select id="select-disabled-option-2" name="victim" required> | |
| 65 <option value="" disabled /> | |
| 66 <option value="X">X</option> | |
| 67 </select> | |
| 68 <script language="JavaScript" type="text/javascript"> | |
| 69 function valueMissingFor(id) { | |
| 70 return document.getElementById(id).validity.valueMissing; | |
| 71 } | |
| 72 | |
| 73 description("This test checks validity.valueMissing with blank values, blank
options selected, or nothing selected."); | |
| 74 | |
| 75 v = document.getElementsByName("victim"); | |
| 76 | |
| 77 shouldBeTrue('valueMissingFor("input")'); | |
| 78 shouldBeTrue('valueMissingFor("textarea")'); | |
| 79 shouldBeTrue('valueMissingFor("select-no-option")'); | |
| 80 shouldBeTrue('valueMissingFor("select-placeholder-selected")'); | |
| 81 shouldBeFalse('valueMissingFor("select-without-placeholder")'); | |
| 82 shouldBeFalse('valueMissingFor("select-placeholder-selected-size2")'); | |
| 83 shouldBeFalse('valueMissingFor("select-without-placeholder-size2")'); | |
| 84 shouldBeTrue('valueMissingFor("select-none-selected-multiple")'); | |
| 85 shouldBeFalse('valueMissingFor("select-fake-placeholder-selected-multiple")'
); | |
| 86 shouldBeFalse('valueMissingFor("select-without-fake-placeholder-multiple")')
; | |
| 87 shouldBeTrue('valueMissingFor("select-none-selected-size2-multiple")'); | |
| 88 shouldBeFalse('valueMissingFor("select-fake-placeholder-selected-size2-multi
ple")'); | |
| 89 shouldBeFalse('valueMissingFor("select-without-fake-placeholder-size2-multip
le")'); | |
| 90 shouldBeFalse('valueMissingFor("select-optgroup")'); | |
| 91 shouldBeTrue('valueMissingFor("select-disabled-option")'); | |
| 92 shouldBeFalse('valueMissingFor("select-disabled-option-2")'); | |
| 93 shouldBe('document.getElementById("select-disabled-option-2").selectedIndex'
, '1'); | |
| 94 </script> | |
| 95 </body> | |
| 96 </html> | |
| OLD | NEW |