[Greasemonkey] dispatchEvent creates an error

Andre gm at andrecgn.de
Tue Aug 23 10:10:11 EDT 2005


Dear all,

I am one of those lurkers who eagerly reads most what's coming down this 
list, but now I have a question of my own:

In a GM script I create a hovering div and I add some event handlers. (I 
read Aaron's mail about this with a lot of attention :-) ). Then I want 
to actually trigger the click event from the script. That causes the 
following error on the JS concole:

    Error: [Exception... "Could not convert JavaScript argument arg 0
    [nsIDOMEventTarget.dispatchEvent]"  nsresult: "0x80570009
    (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame ::
    http://www.xxx.de/usergalerie/singleimage.asp?ID=825746 :: setup ::
    line 75"  data: no]
    Source File: http://www.xxx.de/usergalerie/singleimage.asp?ID=825746
    Line: 75

The code there looks like this:

    trigger.addEventListener("mouseover", eh_onmouseover, false);
    trigger.addEventListener("mouseout", eh_onmouseout, false);  
    trigger.addEventListener("click", eh_onclick, false);        
    trigger.dispatchEvent("click");                              

The code works as intended even after the error. The registered events 
fire as exepected.<

I read the doumentation at 
http://www.mozilla.org/docs/dom/domref/dom_el_ref36.html#1028419

Any help?

Thanks, Andre

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/greasemonkey/attachments/20050823/fc3f6d16/attachment-0001.htm


More information about the Greasemonkey mailing list