OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 | 5 |
6 <div id=test-container> | 6 <div id=test-container> |
7 <p><a id=a1 tabindex=0 title="focusable">Anchor with tab index</a> | 7 <p><a id=a1 tabindex=0>Anchor with tab index</a> |
8 <p><a id=a2 title="not focusable">Anchor without tab index</a> | 8 <p><a id=a2>Anchor without tab index</a> |
9 <p><a id=a3 href="#" title="not focusable">Link without tab index</a> | 9 <p><a id=a3 href="#">Link without tab index</a> |
10 <p><a id=a4 href="#" tabindex=0 title="focusable">Link with tab index</a> | 10 <p><a id=a4 href="#" tabindex=0>Link with tab index</a> |
11 <p><a id=a5 href="#" contentEditable title="focusable">Link with contentEditable
</a> | 11 <p><a id=a5 href="#" contentEditable>Link with contentEditable</a> |
12 <p contenteditable id="p6" title="focusable"><a id=a6 href="#" title="not focusa
ble">Link inside contentEditable</a> | 12 <p contenteditable id="p6"><a id=a6 href="#" title="not focusable">Link inside c
ontentEditable</a> |
13 <p tabindex="1" id="p7" title="focusable"><a id="a7" href="#" title="not focusab
le">Link inside an elment with tabindex</a> | 13 <p tabindex="1" id="p7"><a id="a7" href="#">Link inside an elment with tabindex<
/a> |
| 14 |
| 15 <p><svg width="500" height="30"><a id="svga1" tabindex="0"><text font-size="18px
" y="20">SVG anchor with tab index</text></a></svg></p> |
| 16 <p><svg width="500" height="30"><a id="svga2"><text font-size="18px" y="20">SVG
anchor without tab index</text></a></svg></p> |
| 17 <p><svg width="500" height="30"><a id="svga3" xlink:href="#"><text font-size="18
px" y="20">SVG link without tabindex</text></a></svg></p> |
| 18 <p><svg width="500" height="30"><a id="svga4" xlink:href="#" tabindex="0"><text
font-size="18px" y="20">SVG link with tabindex</text></a></svg></p> |
| 19 <p contentEditable id="psvg5"><svg width="500" height="30"><a id="svga5" xlink:h
ref="#"><text font-size="18px" y="20">SVG link inside contentEditable</text></a>
</svg></p> |
| 20 <p tabindex="1" id="psvg6"><svg width="500" height="30"><a id="svga6" xlink:href
="#"><text font-size="18px" y="20">SVG link inside an element with tabindex</tex
t></a></svg></p> |
14 </div> | 21 </div> |
15 | 22 |
16 <div id="console"></div> | 23 <div id="console"></div> |
17 | 24 |
18 <script> | 25 <script> |
19 description('This test ensures that we can click to focus an a element.'); | 26 description('This test ensures that we can click to focus an a element.'); |
20 | 27 |
21 function handleFocus(e) { | 28 function handleFocus(e) { |
22 var el = e.target; | 29 var el = e.target; |
23 debug(el.id + ' received focus (' + el.title + ')'); | 30 debug(el.id + ' received focus'); |
24 } | 31 } |
25 | 32 |
26 document.addEventListener('focus', handleFocus, true); | 33 document.addEventListener('focus', handleFocus, true); |
27 if (window.testRunner) { | 34 if (window.testRunner) { |
28 for (var i = 1; i <= 7; i++) { | 35 var testAnchors = document.querySelectorAll('p > a, svg > a > text'); |
29 var aElement = document.getElementById('a' + i); | 36 for (var i = 0; i < testAnchors.length; i++) { |
| 37 var aElement = testAnchors[i]; |
30 eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offsetTop + 2)
; | 38 eventSender.mouseMoveTo(aElement.offsetLeft + 2, aElement.offsetTop + 2)
; |
31 eventSender.mouseDown(); | 39 eventSender.mouseDown(); |
32 eventSender.mouseUp(); | 40 eventSender.mouseUp(); |
33 } | 41 } |
34 | 42 |
35 var tc = document.getElementById('test-container'); | 43 var tc = document.getElementById('test-container'); |
36 tc.parentNode.removeChild(tc); | 44 tc.parentNode.removeChild(tc); |
37 } else { | 45 } else { |
38 debug('Need testRunner.'); | 46 debug('Need testRunner.'); |
39 } | 47 } |
40 | 48 |
41 </script> | 49 </script> |
42 </body> | 50 </body> |
43 </html> | 51 </html> |
OLD | NEW |