Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE HTML>
<meta charset="utf-8" />
<title>Element Reflection for ARIA properties</title>
<link rel="author" title="Meredith Lane" href="meredithl@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
function testNullable(element, jsAttr, contentAttr) {
var originalValue = element[jsAttr];
assert_false(originalValue === null);
element[jsAttr] = null;
assert_equals(element[jsAttr], null);
assert_false(element.hasAttribute(contentAttr));
// Setting to undefined results in same state as setting to null.
element[jsAttr] = originalValue;
element[jsAttr] = undefined;
assert_equals(element[jsAttr], null);
assert_false(element.hasAttribute(contentAttr));
}
</script>
<!-- tentative -->
<div id="colindextext" aria-colindextext="x"></div>
<script>
test(function(t) {
var element = document.getElementById("colindextext");
assert_equals(element.ariaColIndexText, "x");
element.ariaColIndexText = "y";
assert_equals(element.getAttribute("aria-colindextext"), "y");
testNullable(element, "ariaColIndexText", "aria-colindextext");
}, "aria-colindextext attribute reflects.");
</script>
<!-- tentative -->
<div id="description" aria-description="cold as ice"></div>
<script>
test(function(t) {
var element = document.getElementById("description");
assert_equals(element.ariaDescription, "cold as ice");
element.ariaDescription = "hot as fire";
assert_equals(element.getAttribute("aria-description"), "hot as fire");
testNullable(element, "ariaDescription", "aria-description");
}, "aria-description attribute reflects.");
</script>
<!-- tentative -->
<div id="rowindextext" aria-rowindextext="x"></div>
<script>
test(function(t) {
var element = document.getElementById("rowindextext");
assert_equals(element.ariaRowIndexText, "x");
element.ariaRowIndexText = "y";
assert_equals(element.getAttribute("aria-rowindextext"), "y");
testNullable(element, "ariaRowIndexText", "aria-rowindextext");
}, "aria-rowindextext attribute reflects.");
</script>
</html>