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

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

From: Simon Pieters <simonp@opera.com>
Date: Thu, 06 May 2010 10:21:41 +0200
To: "www-dom@w3.org" <www-dom@w3.org>
Message-ID: <op.vb9yufltidj3kv@simon-pieterss-macbook.local>

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.

I think it seems like a neat thing to be able to do, for making table rows  
or <canvas> clickable. (However the event shouldn't be a 'trusted' event  
in that case, of course.) To make it work today you'd have to create a new  
event and copy over all properties, which is annoying.

Simon Pieters
Opera Software
Received on Thursday, 6 May 2010 08:22:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:36:56 UTC