Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
michael@0 | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
michael@0 | 3 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
michael@0 | 4 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 5 | <head> |
michael@0 | 6 | <title>Testing controls that should match :enabled/:disabled</title> |
michael@0 | 7 | <style type="text/css"> |
michael@0 | 8 | input, textarea, button, *.hideme { display: none; } |
michael@0 | 9 | div { margin-bottom: 0.2em; } |
michael@0 | 10 | |
michael@0 | 11 | span, option, optgroup { background-color: red; } |
michael@0 | 12 | *:enabled + span.true, option.true:enabled, optgroup.true:enabled { color: lime; background-color: lime; } |
michael@0 | 13 | *:disabled + span.false, option.false:disabled, optgroup.false:disabled { color: lime; background-color: lime; } |
michael@0 | 14 | </style> |
michael@0 | 15 | <script type="text/javascript"> |
michael@0 | 16 | // Runs through i1, i2, .... in and toggles the |disabled| attribute |
michael@0 | 17 | function onLoad() { |
michael@0 | 18 | var i = 1; |
michael@0 | 19 | var el = document.getElementById("i1"); |
michael@0 | 20 | while (el) { |
michael@0 | 21 | if (el.hasAttribute("disabled")) { |
michael@0 | 22 | el.removeAttribute("disabled"); |
michael@0 | 23 | } else { |
michael@0 | 24 | el.setAttribute("disabled", "disabled"); |
michael@0 | 25 | } |
michael@0 | 26 | ++i; |
michael@0 | 27 | el = document.getElementById("i" + i); |
michael@0 | 28 | } |
michael@0 | 29 | if (i != 31) { |
michael@0 | 30 | alert("onLoad() handler failed!"); |
michael@0 | 31 | } |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | window.addEventListener("load", onLoad, false); |
michael@0 | 35 | </script> |
michael@0 | 36 | </head> |
michael@0 | 37 | <body> |
michael@0 | 38 | <div> |
michael@0 | 39 | There should be no red in the following (note: form styling should be enabled). |
michael@0 | 40 | </div> |
michael@0 | 41 | |
michael@0 | 42 | <form method="get" action="."> |
michael@0 | 43 | <div> |
michael@0 | 44 | input: |
michael@0 | 45 | <input/> <span class="true">FAIL</span> |
michael@0 | 46 | <input disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 47 | <input id="i1"/> <span class="false">FAIL</span> |
michael@0 | 48 | <input id="i2" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 49 | </div> |
michael@0 | 50 | |
michael@0 | 51 | <div> |
michael@0 | 52 | password: |
michael@0 | 53 | <input type="password"/> <span class="true">FAIL</span> |
michael@0 | 54 | <input type="password" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 55 | <input type="password" id="i3"/> <span class="false">FAIL</span> |
michael@0 | 56 | <input type="password" id="i4" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 57 | </div> |
michael@0 | 58 | |
michael@0 | 59 | <div> |
michael@0 | 60 | checkbox: |
michael@0 | 61 | <input type="checkbox"/> <span class="true">FAIL</span> |
michael@0 | 62 | <input type="checkbox" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 63 | <input type="checkbox" id="i5"/> <span class="false">FAIL</span> |
michael@0 | 64 | <input type="checkbox" id="i6" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 65 | </div> |
michael@0 | 66 | |
michael@0 | 67 | <div> |
michael@0 | 68 | radio: |
michael@0 | 69 | <input type="radio"/> <span class="true">FAIL</span> |
michael@0 | 70 | <input type="radio" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 71 | <input type="radio" id="i7"/> <span class="false">FAIL</span> |
michael@0 | 72 | <input type="radio" id="i8" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 73 | </div> |
michael@0 | 74 | |
michael@0 | 75 | <div> |
michael@0 | 76 | submit: |
michael@0 | 77 | <input type="submit"/> <span class="true">FAIL</span> |
michael@0 | 78 | <input type="submit" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 79 | <input type="submit" id="i9"/> <span class="false">FAIL</span> |
michael@0 | 80 | <input type="submit" id="i10" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 81 | </div> |
michael@0 | 82 | |
michael@0 | 83 | <div> |
michael@0 | 84 | reset: |
michael@0 | 85 | <input type="reset"/> <span class="true">FAIL</span> |
michael@0 | 86 | <input type="reset" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 87 | <input type="reset" id="i11"/> <span class="false">FAIL</span> |
michael@0 | 88 | <input type="reset" id="i12" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 89 | </div> |
michael@0 | 90 | |
michael@0 | 91 | <div> |
michael@0 | 92 | file: |
michael@0 | 93 | <input type="file"/> <span class="true">FAIL</span> |
michael@0 | 94 | <input type="file" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 95 | <input type="file" id="i13"/> <span class="false">FAIL</span> |
michael@0 | 96 | <input type="file" id="i14" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 97 | </div> |
michael@0 | 98 | |
michael@0 | 99 | <div> |
michael@0 | 100 | hidden: |
michael@0 | 101 | <input type="hidden"/> <span class="true">FAIL</span> |
michael@0 | 102 | <input type="hidden" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 103 | <input type="hidden" id="i15"/> <span class="false">FAIL</span> |
michael@0 | 104 | <input type="hidden" id="i16" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 105 | </div> |
michael@0 | 106 | |
michael@0 | 107 | <div> |
michael@0 | 108 | image: |
michael@0 | 109 | <input type="image"/> <span class="true">FAIL</span> |
michael@0 | 110 | <input type="image" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 111 | <input type="image" id="i17"/> <span class="false">FAIL</span> |
michael@0 | 112 | <input type="image" id="i18" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 113 | </div> |
michael@0 | 114 | |
michael@0 | 115 | <div> |
michael@0 | 116 | button (input): |
michael@0 | 117 | <input type="button"/> <span class="true">FAIL</span> |
michael@0 | 118 | <input type="button" disabled="disabled"/> <span class="false">FAIL</span> |
michael@0 | 119 | <input type="button" id="i19"/> <span class="false">FAIL</span> |
michael@0 | 120 | <input type="button" id="i20" disabled="disabled"/> <span class="true">FAIL</span> |
michael@0 | 121 | </div> |
michael@0 | 122 | |
michael@0 | 123 | <div> |
michael@0 | 124 | textarea: |
michael@0 | 125 | <textarea cols="5" rows="5"></textarea> <span class="true">FAIL</span> |
michael@0 | 126 | <textarea cols="5" rows="5" disabled="disabled"></textarea> <span class="false">FAIL</span> |
michael@0 | 127 | <textarea cols="5" rows="5" id="i21"></textarea> <span class="false">FAIL</span> |
michael@0 | 128 | <textarea cols="5" rows="5" id="i22" disabled="disabled"></textarea> <span class="true">FAIL</span> |
michael@0 | 129 | </div> |
michael@0 | 130 | |
michael@0 | 131 | <div> |
michael@0 | 132 | button: |
michael@0 | 133 | <button>bogus</button> <span class="true">FAIL</span> |
michael@0 | 134 | <button disabled="disabled">bogus</button> <span class="false">FAIL</span> |
michael@0 | 135 | <button id="i23">bogus</button> <span class="false">FAIL</span> |
michael@0 | 136 | <button id="i24" disabled="disabled">bogus</button> <span class="true">FAIL</span> |
michael@0 | 137 | </div> |
michael@0 | 138 | |
michael@0 | 139 | <div> |
michael@0 | 140 | select: |
michael@0 | 141 | <select class="hideme"><option>bogus</option></select> <span class="true">FAIL</span> |
michael@0 | 142 | <select class="hideme" disabled="disabled"><option>bogus</option></select> <span class="false">FAIL</span> |
michael@0 | 143 | <select class="hideme" id="i25"><option>bogus</option></select> <span class="false">FAIL</span> |
michael@0 | 144 | <select class="hideme" id="i26" disabled="disabled"><option>bogus</option></select> <span class="true">FAIL</span> |
michael@0 | 145 | |
michael@0 | 146 | </div> |
michael@0 | 147 | |
michael@0 | 148 | <div> |
michael@0 | 149 | option: |
michael@0 | 150 | <select size="4"> |
michael@0 | 151 | <option class="true">FAIL</option> |
michael@0 | 152 | <option class="false" disabled="disabled">FAIL</option> |
michael@0 | 153 | <option class="false" id="i27">FAIL</option> |
michael@0 | 154 | <option class="true" id="i28" disabled="disabled">FAIL</option> |
michael@0 | 155 | </select> |
michael@0 | 156 | </div> |
michael@0 | 157 | |
michael@0 | 158 | <div> |
michael@0 | 159 | optgroup: |
michael@0 | 160 | <select size="4"> |
michael@0 | 161 | <optgroup class="true" label="FAIL"> |
michael@0 | 162 | <option class="hideme">bogus</option> |
michael@0 | 163 | </optgroup> |
michael@0 | 164 | <optgroup class="false" disabled="disabled" label="FAIL"> |
michael@0 | 165 | <option class="hideme">bogus</option> |
michael@0 | 166 | </optgroup> |
michael@0 | 167 | <optgroup class="false" id="i29" label="FAIL"> |
michael@0 | 168 | <option class="hideme">bogus</option> |
michael@0 | 169 | </optgroup> |
michael@0 | 170 | <optgroup class="true" disabled="disabled" id="i30" label="FAIL"> |
michael@0 | 171 | <option class="hideme">bogus</option> |
michael@0 | 172 | </optgroup> |
michael@0 | 173 | </select> |
michael@0 | 174 | </div> |
michael@0 | 175 | |
michael@0 | 176 | </form> |
michael@0 | 177 | |
michael@0 | 178 | </body> |
michael@0 | 179 | </html> |