[Project_owners] firing custom oncommand event

Malte Kraus firefox at maltekraus.de
Fri Feb 2 14:31:07 PST 2007


Hi,

does anybody know how to create and dispatch an own command event?

I tried doing it like this, but the listeners are never called though 
there are no error messages in the javascript console...

// event is a command event fired by clicking a menuitem
// independentNode is a node having nothing to do with that menuitem
// and being at a completely different position in the DOM.
var evt = document.createEvent("XULCommandEvent");
evt.initCommandEvent("command", true, true, window, 1, false, false,
                      false, false, event);
independentNode.dispatchEvent(evt);

Anybody knows how to change this code so it actually works?

Malte


More information about the Project_owners mailing list