[html5] Propagating custom Events?

Rik Sagar org.whatwg at sagar.org
Fri Apr 9 11:49:17 PDT 2010


Was the idea of allowing custom event types ever discussed for HTML5?
Correct me if I'm wrong, but currently the document will only propagate
events of known types (UIEvents MouseEvents MutationEvents HTMLEvents), and
you can't add other event types to propagate via dispatchEvent()?

I was trying to use the addEventListener()/dispatchEvent() model to
distribute events in my (javascript) app.  I thought I would be able to do:
   mydiv.addEventListener('my_event_1', cb, false);

and later:
   mydiv.dispatchEvent(evt);

However, to do this I needed to create an event object (evt) and when I
tried to create an event using document.createEvent() it seemed I could only
use pre-existing event types.

For someone writing any kind of Javascript toolkit it seems this would be
useful.

var evt = document.createEvent("ApplicationEvent");
evt.initEvent("my_event_1");



Thanks,
Rik.


Rik Sagar, San Jose, CA 95124
Visit : http://sagar.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/help-whatwg.org/attachments/20100409/1752eb89/attachment-0002.htm>


More information about the Help mailing list