Open
Bug 123624
Opened 24 years ago
Updated 3 years ago
click() event does not fire on menuitems in browser
Categories
(Core :: XUL, defect)
Tracking
()
REOPENED
mozilla1.2alpha
People
(Reporter: shrir, Unassigned)
Details
Attachments
(1 file)
|
433 bytes,
application/vnd.mozilla.xul+xml
|
Details |
var save = document.getElementById("ok");
save.click();
Shouldn't this generate a click event on the ok button ?
Comment 1•24 years ago
|
||
not according to the DOM2 HTML spec, and not according to our current
implementation ;-) however perhaps NS4 allowed it...
Comment 2•24 years ago
|
||
It currently works, though.
Comment 3•24 years ago
|
||
I was assuming we're talking about XUL buttons.
Comment 4•24 years ago
|
||
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script>
function routeClick() {
var save = document.getElementById("ok");
save.click();
}
</script>
<button id="ok" label="id ok" onclick="alert('id ok onclick handler');"/>
<button id="ko" label="other" onclick="routeClick();"/>
</window>
Comment 5•24 years ago
|
||
Yeah, it does with my recent checkin that generates mousedown/up/click events
_and_ calls DoCommand from nsXULElement::Click().
WFM
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
| Reporter | ||
Comment 6•24 years ago
|
||
ugh..I did not explain myself properly..sorry abt that.:(
In my testcase below, click event does not work on any menuitem. I am trying to
deliver a click on the 'Go Offline' menuitem without user intervention. But it
does not work. Showed this to jrgm, he also tried to create and deliver an
event to this thing..but it does not work.
----copy------
<title>js test</title>
<script type="application/x-javascript">
function getXULDocument()
{
var windowMediator =
Components.classes["@mozilla.org/rdf/datasource;1?name=window-mediator"]
.getService(Components.interfaces.nsIWindowMediator);
var lastWindow = windowMediator.getMostRecentWindow(null);
return lastWindow.document;
}
function openMenu()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var doc = getXULDocument();
var fileMenu = doc.getElementById("menu_File");
var menuBoxObject =
fileMenu.boxObject.QueryInterface(Components.interfaces.nsIMenuBoxObject);
menuBoxObject.openMenu(true);
var goOffline = doc.getElementById("offlineGoOfflineCmd");
goOffline.click();
}
</script>
<p>
<ul>
<li><a href="" onclick="openMenu()">open menu</a></li>
</ul>
</p>
----end--------
Summary: click() event does not fire → click() event does not fire on menuitems in browser
Updated•17 years ago
|
Assignee: jag → nobody
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•