Open Bug 123624 Opened 24 years ago Updated 3 years ago

click() event does not fire on menuitems in browser

Categories

(Core :: XUL, defect)

x86
Windows NT
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 ?
not according to the DOM2 HTML spec, and not according to our current implementation ;-) however perhaps NS4 allowed it...
It currently works, though.
I was assuming we're talking about XUL buttons.
Attached file er, it does, no? —
<?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>
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
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
Reopening then
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
-> 1.2
Target Milestone: --- → mozilla1.2
shouldn't you trigger command()?
Assignee: jag → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: