I am trying to simulate a mouse click event on GWT (Google
Web Toolkit) Application in <=IE8
(using fireEvent, not dispatchEvent)
A sample custom button can be found here: http://samples.gwtproject.org/samples/Showcase/Showcase.html#!CwCustomButton
(The toggle button is easiest to see if the click was
processed)
The major boilerplate for simulating the click can be found
here: http://stackoverflow.com/a/6158050
(This is where I got the simulate function
used below)
I have been able to successfully simulate the click event
by using the following commands for IE9+
(in this case simulate used dispatchEvent)
simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mouseover");
simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mousedown");
simulate(document.getElementById("gwt-debug-cwCustomButton-toggle-normal"), "mouseup");
In my application the fireEvent fails,
because GWT's $wnd.event is null. (Line: 117,
https://github.com/stephenh/google-web-toolkit/blob/master/user/src/com/google/gwt/user/client/impl/DOMImplTrident.java)
If there is no way to simulate the click with plain JS,
then is there a way to use GWT's EventDispatcher
to simulate the click?