- From: Joćo Eiras <joao.eiras@gmail.com>
- Date: Sat, 26 Feb 2011 03:47:33 -0000
- To: "WebApps WG" <public-webapps@w3.org>
On , Garrett Smith <dhtmlkitchen@gmail.com> wrote:
> On 2/25/11, Anne van Kesteren <annevk@opera.com> wrote:
>> 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.
>>
> Your example is simple. But some common cases of synth events are
> complicated. UI Events aren't so bad but MouseEvents and especially
> TouchEvents are a lot of work to synthesize.
>
> Most cases for synth events are for testing -- feature test or unit test.
>
> EventTarget.fireEvent(type[, options]);
That's going into the Internet Explorer API.
Received on Saturday, 26 February 2011 03:48:09 UTC