2 <script src=
"../resources/testharness.js"></script>
3 <script src=
"../resources/testharnessreport.js"></script>
6 .hideAllContainers .container {
11 <div class=
"container">
12 <img id=
"img1" src=
"resources/cake.png">
17 var axImg1
= accessibilityController
.accessibleElementById("img1");
18 assert_equals(axImg1
.name
, "");
19 }, "img element without alt");
22 <div class=
"container">
23 <img id=
"img2" title=
"img2-title" src=
"resources/cake.png">
28 var axImg2
= accessibilityController
.accessibleElementById("img2");
29 assert_equals(axImg2
.name
, "img2-title");
30 assert_equals(axImg2
.nameFrom
, "attribute");
31 }, "img element without alt, with title");
34 <div class=
"container">
35 <img id=
"img3" title=
"img3-title" alt=
"img3-alt" src=
"resources/cake.png">
40 var axImg3
= accessibilityController
.accessibleElementById("img3");
41 assert_equals(axImg3
.name
, "img3-alt");
42 assert_equals(axImg3
.nameFrom
, "attribute");
43 }, "img element with title and alt");
46 <div class=
"container">
47 <img id=
"img4" title=
"img4-title" alt=
"img4-alt" aria-label=
"img4-aria-label" src=
"resources/cake.png">
52 var axImg4
= accessibilityController
.accessibleElementById("img4");
53 assert_equals(axImg4
.name
, "img4-aria-label");
54 assert_equals(axImg4
.nameFrom
, "attribute");
55 }, "img element with title and alt");
58 <div class=
"container">
59 <img id=
"img5" title=
"img5-title" alt=
"img5-alt" aria-label=
"img5-aria-label" aria-labelledby=
"labelledby5" src=
"resources/cake.png">
60 <span hidden=
"true" id=
"labelledby5">img5-aria-labelledby
</span>
65 var axImg5
= accessibilityController
.accessibleElementById("img5");
66 assert_equals(axImg5
.name
, "img5-aria-labelledby");
67 assert_equals(axImg5
.nameFrom
, "relatedElement");
68 }, "img element with title and alt");
72 if (window
.testRunner
)
73 document
.body
.className
= "hideAllContainers";