OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function log(msg) { | 4 function log(msg) { |
5 document.getElementById('log').appendChild(document.createTextNode(m
sg + '\n')); | 5 document.getElementById('log').appendChild(document.createTextNode(m
sg + '\n')); |
6 } | 6 } |
7 | 7 |
8 function logTabIndex(elem) { | 8 function logTabIndex(elem) { |
9 log('getAttribute("tabindex") = ' + elem.getAttribute('tabindex') +
'; tabIndex = ' + elem.tabIndex); | 9 log('getAttribute("tabindex") = ' + elem.getAttribute('tabindex') +
'; tabIndex = ' + elem.tabIndex); |
10 } | 10 } |
11 | 11 |
12 function test() { | 12 function test() { |
13 if (window.testRunner) { | 13 if (window.testRunner) { |
14 testRunner.dumpAsText(); | 14 testRunner.dumpAsText(); |
15 } | 15 } |
16 | 16 |
17 log('Testing input elements in the page'); | 17 log('Testing input elements in the page'); |
18 | 18 |
19 var inputs = document.getElementsByTagName('input'); | 19 var inputs = document.getElementsByTagName('input'); |
20 for (var i = 0; i < inputs.length; ++i) { | 20 for (var i = 0; i < inputs.length; ++i) { |
21 logTabIndex(inputs[i]); | 21 logTabIndex(inputs[i]); |
22 } | 22 } |
23 | 23 |
24 var indices = [40000, 32768, 32767, 32766, 0, -1, -32767, -32768, -4
0000]; | 24 var indices = [3147483648, 2147483648, 2147483647, 2147483646, 0, -1
, -2147483647, -2147483648, -3147483648, "", "foo"]; |
25 | 25 |
26 log('Testing setAttribute on an anchor element made with document.cr
eateElement'); | 26 log('Testing setAttribute on an anchor element made with document.cr
eateElement'); |
27 | 27 |
28 var elem = document.createElement('a'); | 28 var elem = document.createElement('a'); |
29 for (var i = 0; i < indices.length; ++i) { | 29 for (var i = 0; i < indices.length; ++i) { |
30 elem.setAttribute('tabindex', indices[i]); | 30 elem.setAttribute('tabindex', indices[i]); |
31 logTabIndex(elem); | 31 logTabIndex(elem); |
32 } | 32 } |
33 | 33 |
34 log('Testing tabIndex on an area element made with document.createEl
ement'); | 34 log('Testing tabIndex on an area element made with document.createEl
ement'); |
35 | 35 |
36 var elem = document.createElement('area'); | 36 var elem = document.createElement('area'); |
37 for (var i = 0; i < indices.length; ++i) { | 37 for (var i = 0; i < indices.length; ++i) { |
38 elem.tabIndex = indices[i]; | 38 elem.tabIndex = indices[i]; |
39 logTabIndex(elem); | 39 logTabIndex(elem); |
40 } | 40 } |
41 } | 41 } |
42 </script> | 42 </script> |
43 </head> | 43 </head> |
44 <body onload="test()"> | 44 <body onload="test()"> |
45 <p>This page tests that the <tt>tabindex</tt> attribute is clamped to | 45 <p>This page tests that the <tt>tabindex</tt> attribute is accepted for |
46 values between -32768 and 32767. Values outside of this range should be | 46 values between -2147483648 and 2147483647. Values outside of this range will |
47 clamped to the range limits.</p> | 47 make the tabIndex reflected value zero.</p> |
48 | 48 |
49 <input tabindex="40000"> | 49 <input tabindex="3147483648"> |
50 <input tabindex="32768"> | 50 <input tabindex="2147483648"> |
51 <input tabindex="32767"> | 51 <input tabindex="2147483647"> |
52 <input tabindex="32766"> | 52 <input tabindex="2147483646"> |
53 <input tabindex="0"> | 53 <input tabindex="0"> |
54 <input tabindex="-1"> | 54 <input tabindex="-1"> |
55 <input tabindex="-32767"> | 55 <input tabindex="-2147483647"> |
56 <input tabindex="-32768"> | 56 <input tabindex="-2147483648"> |
57 <input tabindex="-32769"> | 57 <input tabindex="-2147483649"> |
58 <input tabindex="-40000"> | 58 <input tabindex="-3147483648"> |
59 | 59 |
60 <pre id="log"></pre> | 60 <pre id="log"></pre> |
61 </body> | 61 </body> |
62 </html> | 62 </html> |
OLD | NEW |