Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Accessible ARIA object attribute changes</title> |
michael@0 | 5 | |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../common.js"></script> |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../events.js"></script> |
michael@0 | 16 | |
michael@0 | 17 | <script type="application/javascript"> |
michael@0 | 18 | |
michael@0 | 19 | /** |
michael@0 | 20 | * Do tests. |
michael@0 | 21 | */ |
michael@0 | 22 | var gQueue = null; |
michael@0 | 23 | |
michael@0 | 24 | function updateAttribute(aID, aAttr, aValue) |
michael@0 | 25 | { |
michael@0 | 26 | this.node = getNode(aID); |
michael@0 | 27 | this.accessible = getAccessible(this.node); |
michael@0 | 28 | |
michael@0 | 29 | this.eventSeq = [ |
michael@0 | 30 | new invokerChecker(EVENT_OBJECT_ATTRIBUTE_CHANGED, this.accessible), |
michael@0 | 31 | ]; |
michael@0 | 32 | |
michael@0 | 33 | this.invoke = function updateAttribute_invoke() |
michael@0 | 34 | { |
michael@0 | 35 | this.node.setAttribute(aAttr, aValue); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | this.getID = function updateAttribute_getID() |
michael@0 | 39 | { |
michael@0 | 40 | return aAttr + " for " + aID + " " + aValue; |
michael@0 | 41 | } |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | // Debug stuff. |
michael@0 | 45 | // gA11yEventDumpID = "eventdump"; |
michael@0 | 46 | //gA11yEventDumpToConsole = true; |
michael@0 | 47 | |
michael@0 | 48 | function doTests() |
michael@0 | 49 | { |
michael@0 | 50 | gQueue = new eventQueue(); |
michael@0 | 51 | |
michael@0 | 52 | gQueue.push(new updateAttribute("hideable", "aria-hidden", "true")); |
michael@0 | 53 | |
michael@0 | 54 | gQueue.push(new updateAttribute("sortable", "aria-sort", "ascending")); |
michael@0 | 55 | |
michael@0 | 56 | // For experimental ARIA extensions |
michael@0 | 57 | gQueue.push(new updateAttribute("custom", "aria-blah", "true")); |
michael@0 | 58 | |
michael@0 | 59 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 63 | addA11yLoadEvent(doTests); |
michael@0 | 64 | </script> |
michael@0 | 65 | </head> |
michael@0 | 66 | |
michael@0 | 67 | <body> |
michael@0 | 68 | |
michael@0 | 69 | <a target="_blank" |
michael@0 | 70 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=581096" |
michael@0 | 71 | title="Add support for aria-hidden"> |
michael@0 | 72 | Mozilla Bug 581096 |
michael@0 | 73 | </a> |
michael@0 | 74 | |
michael@0 | 75 | <a target="_blank" |
michael@0 | 76 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=640707" |
michael@0 | 77 | title="Add event support for aria-sort"> |
michael@0 | 78 | Mozilla Bug 640707 |
michael@0 | 79 | </a> |
michael@0 | 80 | |
michael@0 | 81 | <a target="_blank" |
michael@0 | 82 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=640707" |
michael@0 | 83 | title="Expand support for aria attribute change events"> |
michael@0 | 84 | Mozilla Bug 563862 |
michael@0 | 85 | </a> |
michael@0 | 86 | |
michael@0 | 87 | <p id="display"></p> |
michael@0 | 88 | <div id="content" style="display: none"></div> |
michael@0 | 89 | <pre id="test"> |
michael@0 | 90 | </pre> |
michael@0 | 91 | <div id="eventdump"></div> |
michael@0 | 92 | |
michael@0 | 93 | <div id="hideable"><div>Hi</div><div>there</div></div> |
michael@0 | 94 | |
michael@0 | 95 | <div id="sortable" role="columnheader" aria-sort="none">aria-sort</div> |
michael@0 | 96 | |
michael@0 | 97 | <div id="custom" role="custom" aria-blah="false">Fat free cheese</div> |
michael@0 | 98 | </body> |
michael@0 | 99 | </html> |