2009-02-15 00:29:45 -08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=420863
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Table indexes chrome tests</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
|
2009-09-10 06:41:46 -07:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="common.js"></script>
|
2009-09-10 06:41:46 -07:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="events.js"></script>
|
2009-09-10 06:41:46 -07:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="actions.js"></script>
|
2009-02-15 00:29:45 -08:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
var gClickHandler = null;
|
|
|
|
|
|
|
|
function doTest()
|
|
|
|
{
|
|
|
|
// Actions should be exposed on any accessible having related DOM node
|
|
|
|
// with registered 'click' event handler.
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// generic td
|
2009-09-10 06:41:46 -07:00
|
|
|
var td1Acc = getAccessible("td1");
|
|
|
|
if (!td1Acc) {
|
|
|
|
SimpleTest.finish();
|
|
|
|
return;
|
|
|
|
}
|
2009-02-15 00:29:45 -08:00
|
|
|
|
2009-09-10 06:41:46 -07:00
|
|
|
is(td1Acc.numActions, 0,
|
|
|
|
"Simple table cell shouldn't have any actions");
|
2009-02-15 00:29:45 -08:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2009-09-10 06:41:46 -07:00
|
|
|
// one td with 'onclick' attribute and one with registered click handler
|
|
|
|
var td3Node = getNode("td3");
|
2009-02-15 00:29:45 -08:00
|
|
|
|
|
|
|
// register 'click' event handler
|
|
|
|
gClickHandler = {
|
|
|
|
handleEvent: function handleEvent(aEvent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2009-09-10 06:41:46 -07:00
|
|
|
td3Node.addEventListener("click", gClickHandler, false);
|
2009-02-15 00:29:45 -08:00
|
|
|
|
|
|
|
// check actions
|
2009-09-10 06:41:46 -07:00
|
|
|
var actionsArray = [
|
|
|
|
{
|
|
|
|
ID: "td2", // "onclick" attribute
|
|
|
|
actionName: "click",
|
|
|
|
actionIndex: 0,
|
|
|
|
events: CLICK_EVENTS
|
|
|
|
},
|
|
|
|
{
|
|
|
|
ID: td3Node,
|
|
|
|
actionName: "click",
|
|
|
|
actionIndex: 0,
|
|
|
|
events: CLICK_EVENTS,
|
|
|
|
checkOnClickEvent: function check(aEvent)
|
|
|
|
{
|
|
|
|
// unregister click event handler
|
|
|
|
this.ID.removeEventListener("click", gClickHandler, false);
|
|
|
|
|
|
|
|
// check actions
|
|
|
|
is(getAccessible(this.ID).numActions, 0,
|
|
|
|
"td3 shouldn't have actions");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
2009-02-15 00:29:45 -08:00
|
|
|
|
2009-09-10 06:41:46 -07:00
|
|
|
testActions(actionsArray); // will call SimpleTest.finish()
|
2009-02-15 00:29:45 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2009-09-23 07:21:47 -07:00
|
|
|
addA11yLoadEvent(doTest);
|
2009-02-15 00:29:45 -08:00
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=420863"
|
|
|
|
title="If an HTML element has an onClick attribute, expose its click action on the element rather than its child text leaf node."
|
|
|
|
target="_blank">Mozilla Bug 420863</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td id="td1">Can't click this cell</td>
|
|
|
|
<td onclick="gTdClickAttr = true;"
|
|
|
|
id="td2">Cell with 'onclick' attribute</td>
|
|
|
|
<td id="td3">Cell with registered 'click' event handler</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|