Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / tabindex-clamp.html
blob8561f52cc94378b1947da0d19072dd04e48bd25c
1 <html>
2 <head>
3 <script>
4 function log(msg) {
5 document.getElementById('log').appendChild(document.createTextNode(msg + '\n'));
8 function logTabIndex(elem) {
9 log('getAttribute("tabindex") = ' + elem.getAttribute('tabindex') + '; tabIndex = ' + elem.tabIndex);
12 function test() {
13 if (window.testRunner) {
14 testRunner.dumpAsText();
17 log('Testing input elements in the page');
19 var inputs = document.getElementsByTagName('input');
20 for (var i = 0; i < inputs.length; ++i) {
21 logTabIndex(inputs[i]);
24 var indices = [40000, 32768, 32767, 32766, 0, -1, -32767, -32768, -40000];
26 log('Testing setAttribute on an anchor element made with document.createElement');
28 var elem = document.createElement('a');
29 for (var i = 0; i < indices.length; ++i) {
30 elem.setAttribute('tabindex', indices[i]);
31 logTabIndex(elem);
34 log('Testing tabIndex on an area element made with document.createElement');
36 var elem = document.createElement('area');
37 for (var i = 0; i < indices.length; ++i) {
38 elem.tabIndex = indices[i];
39 logTabIndex(elem);
42 </script>
43 </head>
44 <body onload="test()">
45 <p>This page tests that the <tt>tabindex</tt> attribute is clamped to
46 values between -32768 and 32767. Values outside of this range should be
47 clamped to the range limits.</p>
49 <input tabindex="40000">
50 <input tabindex="32768">
51 <input tabindex="32767">
52 <input tabindex="32766">
53 <input tabindex="0">
54 <input tabindex="-1">
55 <input tabindex="-32767">
56 <input tabindex="-32768">
57 <input tabindex="-32769">
58 <input tabindex="-40000">
60 <pre id="log"></pre>
61 </body>
62 </html>