| <html> |
| <head> |
| <script> |
| function log(msg) { |
| document.getElementById('log').appendChild(document.createTextNode(msg + '\n')); |
| } |
| |
| function logTabIndex(elem) { |
| log('getAttribute("tabindex") = ' + elem.getAttribute('tabindex') + '; tabIndex = ' + elem.tabIndex); |
| } |
| |
| function test() { |
| if (window.layoutTestController) { |
| layoutTestController.dumpAsText(); |
| } |
| |
| log('Testing input elements in the page'); |
| |
| var inputs = document.getElementsByTagName('input'); |
| for (var i = 0; i < inputs.length; ++i) { |
| logTabIndex(inputs[i]); |
| } |
| |
| var indices = [40000, 32768, 32767, 32766, 0, -1, -32767, -32768, -40000]; |
| |
| log('Testing setAttribute on an anchor element made with document.createElement'); |
| |
| var elem = document.createElement('a'); |
| for (var i = 0; i < indices.length; ++i) { |
| elem.setAttribute('tabindex', indices[i]); |
| logTabIndex(elem); |
| } |
| |
| log('Testing tabIndex on an area element made with document.createElement'); |
| |
| var elem = document.createElement('area'); |
| for (var i = 0; i < indices.length; ++i) { |
| elem.tabIndex = indices[i]; |
| logTabIndex(elem); |
| } |
| } |
| </script> |
| </head> |
| <body onload="test()"> |
| <p>This page tests that the <tt>tabindex</tt> attribute is clamped to |
| values between -32768 and 32767. Values outside of this range should be |
| clamped to the range limits.</p> |
| |
| <input tabindex="40000"> |
| <input tabindex="32768"> |
| <input tabindex="32767"> |
| <input tabindex="32766"> |
| <input tabindex="0"> |
| <input tabindex="-1"> |
| <input tabindex="-32767"> |
| <input tabindex="-32768"> |
| <input tabindex="-32769"> |
| <input tabindex="-40000"> |
| |
| <pre id="log"></pre> |
| </body> |
| </html> |