Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/tabindex-clamp.html

Issue 2362223002: Stop clamping tabIndex to short range (Closed)
Patch Set: Fix tabindex-clamp.html Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <style>
4 input { display: none; }
5 </style>
3 <script> 6 <script>
4 function log(msg) { 7 function log(msg) {
5 document.getElementById('log').appendChild(document.createTextNode(m sg + '\n')); 8 document.getElementById('log').appendChild(document.createTextNode(m sg + '\n'));
6 } 9 }
7 10
8 function logTabIndex(elem) { 11 function logTabIndex(elem) {
9 log('getAttribute("tabindex") = ' + elem.getAttribute('tabindex') + '; tabIndex = ' + elem.tabIndex); 12 log('getAttribute("tabindex") = ' + elem.getAttribute('tabindex') + '; tabIndex = ' + elem.tabIndex);
10 } 13 }
11 14
12 function test() { 15 function test() {
13 if (window.testRunner) { 16 if (window.testRunner) {
14 testRunner.dumpAsText(); 17 testRunner.dumpAsText();
15 } 18 }
16 19
17 log('Testing input elements in the page'); 20 log('Testing input elements in the page');
18 21
19 var inputs = document.getElementsByTagName('input'); 22 var inputs = document.getElementsByTagName('input');
20 for (var i = 0; i < inputs.length; ++i) { 23 for (var i = 0; i < inputs.length; ++i) {
21 logTabIndex(inputs[i]); 24 logTabIndex(inputs[i]);
22 } 25 }
23 26
24 var indices = [40000, 32768, 32767, 32766, 0, -1, -32767, -32768, -4 0000]; 27 var indices = [3147483648, 2147483648, 2147483647, 2147483646, 0, -1 , -2147483647, -2147483648, -3147483648, "", "foo"];
25 28
26 log('Testing setAttribute on an anchor element made with document.cr eateElement'); 29 log('Testing setAttribute on an anchor element made with document.cr eateElement');
27 30
28 var elem = document.createElement('a'); 31 var elem = document.createElement('a');
29 for (var i = 0; i < indices.length; ++i) { 32 for (var i = 0; i < indices.length; ++i) {
30 elem.setAttribute('tabindex', indices[i]); 33 elem.setAttribute('tabindex', indices[i]);
31 logTabIndex(elem); 34 logTabIndex(elem);
32 } 35 }
33 36
34 log('Testing tabIndex on an area element made with document.createEl ement'); 37 log('Testing tabIndex on an area element made with document.createEl ement');
35 38
36 var elem = document.createElement('area'); 39 var elem = document.createElement('area');
37 for (var i = 0; i < indices.length; ++i) { 40 for (var i = 0; i < indices.length; ++i) {
38 elem.tabIndex = indices[i]; 41 elem.tabIndex = indices[i];
39 logTabIndex(elem); 42 logTabIndex(elem);
40 } 43 }
41 } 44 }
42 </script> 45 </script>
43 </head> 46 </head>
44 <body onload="test()"> 47 <body onload="test()">
45 <p>This page tests that the <tt>tabindex</tt> attribute is clamped to 48 <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 49 values between -2147483648 and 2147483647. Values outside of this range will
47 clamped to the range limits.</p> 50 make the tabIndex reflected value zero.</p>
48 51
49 <input tabindex="40000"> 52 <input tabindex="3147483648">
50 <input tabindex="32768"> 53 <input tabindex="2147483648">
51 <input tabindex="32767"> 54 <input tabindex="2147483647">
52 <input tabindex="32766"> 55 <input tabindex="2147483646">
53 <input tabindex="0"> 56 <input tabindex="0">
54 <input tabindex="-1"> 57 <input tabindex="-1">
55 <input tabindex="-32767"> 58 <input tabindex="-2147483647">
56 <input tabindex="-32768"> 59 <input tabindex="-2147483648">
57 <input tabindex="-32769"> 60 <input tabindex="-2147483649">
58 <input tabindex="-40000"> 61 <input tabindex="-3147483648">
59 62
60 <pre id="log"></pre> 63 <pre id="log"></pre>
61 </body> 64 </body>
62 </html> 65 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698