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

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

Thanks.

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