W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2010

Re: [dom-events] dispatchEvent()ing a UA-dispatched event

From: Simon Pieters <simonp@opera.com>
Date: Thu, 06 May 2010 13:16:22 +0200
To: www-dom@w3.org, "Stewart Brodie" <stewart.brodie@antplc.com>
Message-ID: <op.vb96xk1kidj3kv@simon-pieterss-macbook.local>
On Thu, 06 May 2010 11:18:38 +0200, Stewart Brodie  
<stewart.brodie@antplc.com> wrote:

> Simon Pieters <simonp@opera.com> wrote:
>> Hi,
>> Is it defined what should happen in the following case?
>> <div onclick="document.links[0].dispatchEvent(event)">click me</div>
>> <a href="http://example.org/">test</a>
>> It seems Firefox and Opera throw an exception, while WebKit allows the
>> event to be dispatched.
> Yes.  It's quite clearly stated in the documentation for dispatchEvent.
> It must be a DISPATCH_REQUEST_ERR exception


For my use case (making table rows or <canvas> clickable without having to  
create a new event and copy over all properties manually), maybe we could  
introduce a cloneEvent API similar to cloneNode? I realize that it is kind  
of messy to redispatch events, but it would be nice with an easy way to  
clone an event and dispatch that.

Simon Pieters
Opera Software
Received on Thursday, 6 May 2010 11:17:05 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:16 UTC