Re: [DOMCore] fire and dispatch

On Fri, 25 Feb 2011 04:05:44 +0100, Garrett Smith <dhtmlkitchen@gmail.com>  
wrote:
> OK. Why not expose a generic version of `fire` to the scripting  
> environment?

I do not know of any research (or have done any myself) as to how often  
such a feature might be useful for authors. While firing an event is  
currently a series of steps (using proposed optional arguments):

   var e = document.createEvent("Event")
   e.initEvent("test")
   dispatchEvent(e)

... it is not hugely complicated. (We could even make the argument to  
createEvent optional too and default it to "Event".) I could imagine  
having something like EventTarget.fireEvent(name) but if you want to get a  
little beyond the basics you will remain stuck with creating the event  
yourself.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Friday, 25 February 2011 10:24:52 UTC