Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=420863 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Table indexes chrome tests</title> |
michael@0 | 8 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 9 | |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 12 | |
michael@0 | 13 | <script type="application/javascript" |
michael@0 | 14 | src="common.js"></script> |
michael@0 | 15 | <script type="application/javascript" |
michael@0 | 16 | src="events.js"></script> |
michael@0 | 17 | <script type="application/javascript" |
michael@0 | 18 | src="actions.js"></script> |
michael@0 | 19 | |
michael@0 | 20 | <script type="application/javascript"> |
michael@0 | 21 | var gClickHandler = null; |
michael@0 | 22 | |
michael@0 | 23 | function doTest() |
michael@0 | 24 | { |
michael@0 | 25 | // Actions should be exposed on any accessible having related DOM node |
michael@0 | 26 | // with registered 'click' event handler. |
michael@0 | 27 | |
michael@0 | 28 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 29 | // generic td |
michael@0 | 30 | var td1Acc = getAccessible("td1"); |
michael@0 | 31 | if (!td1Acc) { |
michael@0 | 32 | SimpleTest.finish(); |
michael@0 | 33 | return; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | is(td1Acc.actionCount, 0, |
michael@0 | 37 | "Simple table cell shouldn't have any actions"); |
michael@0 | 38 | |
michael@0 | 39 | ////////////////////////////////////////////////////////////////////////// |
michael@0 | 40 | // one td with 'onclick' attribute and one with registered click handler |
michael@0 | 41 | var td3Node = getNode("td3"); |
michael@0 | 42 | |
michael@0 | 43 | // register 'click' event handler |
michael@0 | 44 | gClickHandler = { |
michael@0 | 45 | handleEvent: function handleEvent(aEvent) |
michael@0 | 46 | { |
michael@0 | 47 | } |
michael@0 | 48 | }; |
michael@0 | 49 | td3Node.addEventListener("click", gClickHandler, false); |
michael@0 | 50 | |
michael@0 | 51 | // check actions |
michael@0 | 52 | var actionsArray = [ |
michael@0 | 53 | { |
michael@0 | 54 | ID: "td2", // "onclick" attribute |
michael@0 | 55 | actionName: "click", |
michael@0 | 56 | actionIndex: 0, |
michael@0 | 57 | events: CLICK_EVENTS |
michael@0 | 58 | }, |
michael@0 | 59 | { |
michael@0 | 60 | ID: td3Node, |
michael@0 | 61 | actionName: "click", |
michael@0 | 62 | actionIndex: 0, |
michael@0 | 63 | events: CLICK_EVENTS, |
michael@0 | 64 | checkOnClickEvent: function check(aEvent) |
michael@0 | 65 | { |
michael@0 | 66 | // unregister click event handler |
michael@0 | 67 | this.ID.removeEventListener("click", gClickHandler, false); |
michael@0 | 68 | |
michael@0 | 69 | // check actions |
michael@0 | 70 | is(getAccessible(this.ID).actionCount, 0, |
michael@0 | 71 | "td3 shouldn't have actions"); |
michael@0 | 72 | } |
michael@0 | 73 | } |
michael@0 | 74 | ]; |
michael@0 | 75 | |
michael@0 | 76 | testActions(actionsArray); // will call SimpleTest.finish() |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 80 | addA11yLoadEvent(doTest); |
michael@0 | 81 | </script> |
michael@0 | 82 | </head> |
michael@0 | 83 | <body> |
michael@0 | 84 | |
michael@0 | 85 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=420863" |
michael@0 | 86 | title="If an HTML element has an onClick attribute, expose its click action on the element rather than its child text leaf node." |
michael@0 | 87 | target="_blank">Mozilla Bug 420863</a> |
michael@0 | 88 | <p id="display"></p> |
michael@0 | 89 | <div id="content" style="display: none"></div> |
michael@0 | 90 | <pre id="test"> |
michael@0 | 91 | </pre> |
michael@0 | 92 | |
michael@0 | 93 | <table> |
michael@0 | 94 | <tr> |
michael@0 | 95 | <td id="td1">Can't click this cell</td> |
michael@0 | 96 | <td onclick="gTdClickAttr = true;" |
michael@0 | 97 | id="td2">Cell with 'onclick' attribute</td> |
michael@0 | 98 | <td id="td3">Cell with registered 'click' event handler</td> |
michael@0 | 99 | </tr> |
michael@0 | 100 | </table> |
michael@0 | 101 | |
michael@0 | 102 | </body> |
michael@0 | 103 | </html> |