| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 </head> | 4 </head> |
| 5 <body> | 5 <body> |
| 6 | 6 |
| 7 <p>This test ensures that we can click to focus an a element. | 7 <p>This test ensures that we can click to focus an a element. |
| 8 Click on the element below. | 8 Click on the element below. |
| 9 | 9 |
| 10 <p><a tabindex=0 onfocus="pass('r1')" id=t1>Focusable anchor with tab index</a> | 10 <p>The expected result is platform specific. GTK and QT allows all links to be |
| 11 <p><a onfocus="pass('r2')" id=t2 href="#">Focusable anchor</a> | 11 mouse focusable. |
| 12 |
| 13 <div id=test-container> |
| 14 <p><a id=a1 tabindex=0 title="focusable">Anchor with tab index</a> |
| 15 <p><a id=a2 title="not focusable">Anchor without tab index</a> |
| 16 <p><a id=a3 href="#" title="focusable on GTK and QT">Link without tab index</a> |
| 17 <p><a id=a4 href="#" tabindex=0 title="focusable">Link with tab index</a> |
| 18 <p><a id=a5 href="#" contentEditable title="focusable">Link with contentEditable
</a> |
| 19 <p contentEditable><a id=a6 href="#" focusable="not focusable">Link inside conte
ntEditable</a> |
| 20 </div> |
| 12 | 21 |
| 13 <p>Result | 22 <p>Result |
| 14 | 23 |
| 15 <pre id=r1>FAIL</pre> | 24 <pre id=out></pre> |
| 16 <pre id=r2>FAIL</pre> | |
| 17 | 25 |
| 18 <script> | 26 <script> |
| 19 | 27 |
| 20 function pass(id) | 28 function log(s) |
| 21 { | 29 { |
| 22 var el = document.getElementById(id); | 30 var el = document.getElementById('out'); |
| 23 el.textContent = 'PASS'; | 31 el.textContent += '\n' + s; |
| 32 } |
| 33 |
| 34 function handleFocus(e) |
| 35 { |
| 36 var el = e.target; |
| 37 log(el.id + ' received focus (' + el.title + ')'); |
| 24 } | 38 } |
| 25 | 39 |
| 26 if (window.layoutTestController) { | 40 if (window.layoutTestController) { |
| 27 layoutTestController.dumpAsText(); | 41 layoutTestController.dumpAsText(); |
| 28 layoutTestController.overridePreference('WebKitTabToLinksPreferenceKey', fal
se); | |
| 29 } | 42 } |
| 30 | 43 |
| 31 window.onload = function() | 44 window.onload = function() |
| 32 { | 45 { |
| 33 if (!window.layoutTestController) | 46 if (!window.layoutTestController) |
| 34 return; | 47 return; |
| 35 | 48 |
| 36 var aElement = document.getElementById('t1'); | 49 for (var i = 1; i <= 6; i++) { |
| 37 eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offsetTop + 2); | 50 var aElement = document.getElementById('a' + i); |
| 38 eventSender.mouseDown(); | 51 aElement.onfocus = handleFocus; |
| 52 eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offsetTop + 2)
; |
| 53 eventSender.mouseDown(); |
| 54 eventSender.mouseUp(); |
| 55 } |
| 39 | 56 |
| 40 aElement = document.getElementById('t2'); | 57 var tc = document.getElementById('test-container'); |
| 41 eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offsetTop + 2); | 58 tc.parentNode.removeChild(tc); |
| 42 eventSender.mouseDown(); | |
| 43 }; | 59 }; |
| 44 | 60 |
| 45 </script> | 61 </script> |
| 46 </body> | 62 </body> |
| 47 </html> | 63 </html> |
| OLD | NEW |