Re: Dispatch event through DOM event interface

Boris Zbarsky <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <[email protected]>
[email protected] wrote:
> The nsIDOMEventTarget and nsIDOMEvent interfaces allow one to dispatch
> synthetic event to certain element at target. This is working fine for
> triggering event handlers. However, I find these simulated events
> don't change focus, selection ect. For example, if I simulate a click
> on a text node at certain screen location, the onclick handler will
> fire on the parent of this text node, but the caret won't move there.
> Similarly, a simulated click on a button won't switch the focus to the
> button. Is there a way to achieve those?

Those rely on the frame-tree dispatch; the DOM-only dispatch is not enough. 
There are some nsIWindowUtils methods to do what you want, I think.

-Boris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.