aria-attribute-reflection.tentative.html (2239B)
1 <!DOCTYPE HTML> 2 <meta charset="utf-8" /> 3 <title>Element Reflection for ARIA properties</title> 4 <link rel=help href="https://wicg.github.io/aom/spec/aria-reflection.html"> 5 <link rel="author" title="Meredith Lane" href="meredithl@chromium.org"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 <script> 10 function testNullable(element, jsAttr, contentAttr) { 11 var originalValue = element[jsAttr]; 12 assert_false(originalValue === null); 13 element[jsAttr] = null; 14 assert_equals(element[jsAttr], null); 15 assert_false(element.hasAttribute(contentAttr)); 16 // Setting to undefined results in same state as setting to null. 17 element[jsAttr] = originalValue; 18 element[jsAttr] = undefined; 19 assert_equals(element[jsAttr], null); 20 assert_false(element.hasAttribute(contentAttr)); 21 } 22 </script> 23 24 <!-- tentative --> 25 <div id="colindextext" aria-colindextext="x"></div> 26 <script> 27 test(function(t) { 28 var element = document.getElementById("colindextext"); 29 assert_equals(element.ariaColIndexText, "x"); 30 element.ariaColIndexText = "y"; 31 assert_equals(element.getAttribute("aria-colindextext"), "y"); 32 testNullable(element, "ariaColIndexText", "aria-colindextext"); 33 }, "aria-colindextext attribute reflects."); 34 </script> 35 36 <!-- tentative --> 37 <div id="description" aria-description="cold as ice"></div> 38 <script> 39 test(function(t) { 40 var element = document.getElementById("description"); 41 assert_equals(element.ariaDescription, "cold as ice"); 42 element.ariaDescription = "hot as fire"; 43 assert_equals(element.getAttribute("aria-description"), "hot as fire"); 44 testNullable(element, "ariaDescription", "aria-description"); 45 }, "aria-description attribute reflects."); 46 </script> 47 48 <!-- tentative --> 49 <div id="rowindextext" aria-rowindextext="x"></div> 50 <script> 51 test(function(t) { 52 var element = document.getElementById("rowindextext"); 53 assert_equals(element.ariaRowIndexText, "x"); 54 element.ariaRowIndexText = "y"; 55 assert_equals(element.getAttribute("aria-rowindextext"), "y"); 56 testNullable(element, "ariaRowIndexText", "aria-rowindextext"); 57 }, "aria-rowindextext attribute reflects."); 58 </script> 59 60 </html>