OLD | NEW |
---|---|
(Empty) | |
1 <script src="../resources/js-test.js"></script> | |
2 <ul role="presentation"> | |
3 <li role="listitem">Item 1</li> | |
dmazzoni
2015/01/15 16:05:30
nit: could you indent the <li> elements inside the
| |
4 <li role="listitem">Item 2</li> | |
5 <li role="listitem">Item 3</li> | |
6 </ul> | |
7 | |
8 <ul role="presentation"> | |
9 <li>Plain Text 1</li> | |
10 <li>Plain Text 2</li> | |
11 <li>Plain Text 3</li> | |
12 </ul> | |
13 <p>End of test</p> | |
14 <p id="description"></p> | |
15 <div id="console"></div> | |
16 <script> | |
17 description("This tests that the presentation role is inherited."); | |
18 | |
19 if (window.testRunner) | |
20 testRunner.dumpAsText(); | |
21 | |
22 function buildAccessibilityTree(accessibilityObject, indent) { | |
23 var str = ""; | |
24 for (var i = 0; i < indent; i++) | |
25 str += " "; | |
26 str += accessibilityObject.role; | |
27 str += " " + accessibilityObject.stringValue; | |
28 | |
29 if (accessibilityObject.role == '') | |
30 str += accessibilityObject.allAttributes(); | |
31 | |
32 str += "\n"; | |
33 document.getElementById("console").innerText += str; | |
34 | |
35 if (accessibilityObject.stringValue.indexOf('End of test') >= 0) | |
36 return false; | |
37 | |
38 var count = accessibilityObject.childrenCount; | |
39 for (var i = 0; i < count; ++i) { | |
40 if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), indent + 1)) | |
41 return false; | |
42 } | |
43 | |
44 return true; | |
45 } | |
46 | |
47 if (window.accessibilityController) { | |
48 var body = accessibilityController.focusedElement; | |
49 buildAccessibilityTree(body, 0); | |
50 } | |
51 </script> | |
OLD | NEW |