[webkit-dev] Constructors for DOM4 Events

Kentaro Hara haraken at chromium.org
Thu Feb 7 17:39:33 PST 2013


Now all DOM4 event constructors (UIEvent, FocusEvent, MouseEvent,
WheelEvent, CompositionEvent and KeyboardEvent) are implemented under
a DOM4_EVENTS_CONSTRUCTOR flag.

Currently the flag is enabled on Safari and Chromium. Please enable
the flag once your port wants to enable the feature.

Before:
  event=document.createEvent("MouseEvents");
  event.initMouseEvent("click",true,false,null,0,0,0,0,0,false,false,false,false,0,null);

After:
  event = new MouseEvent("click", {bubbles: true});

Spec: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
Bug: https://bugs.webkit.org/show_bug.cgi?id=67824



On Mon, Jan 14, 2013 at 8:38 AM, Sam Weinig <weinig at apple.com> wrote:
> Seems fine to me.
>
> -Sam
>
> On Jan 10, 2013, at 6:36 AM, Kentaro Hara <haraken at chromium.org> wrote:
>
>> At TPAC there was no objection for DOM4 Event constructors (e.g. new
>> MouseEvent()).
>>
>> Now DOM4 Event constructors are on editor's draft:
>> http://html5labs.interoperabilitybridges.com/dom4events/
>> https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
>>
>> Given the above, I am planning to implement them in WebKit (without
>> any flag). If you have any concern, please let me know.
>>
>> Best Regards
>>
>>
>> On Mon, Oct 1, 2012 at 7:44 AM, Kentaro Hara <haraken at chromium.org> wrote:
>>>> Since TPAC is less than a month away, I don't understand why we can't wait for that discussion.
>>>
>>> Sounds reasonable. I'll wait for TPAC.
>>>
>>>> I do support the idea in general, and I plan to be at TPAC and will advocate for it.
>>>
>>> I'll be also going to TPAC. I would appreciate your support.
>>>
>>>
>>>
>>> On Mon, Oct 1, 2012 at 2:11 PM, Maciej Stachowiak <mjs at apple.com> wrote:
>>>>
>>>> Since TPAC is less than a month away, I don't understand why we can't wait for that discussion. I do support the idea in general, and I plan to be at TPAC and will advocate for it.
>>>>
>>>> I understand that sometimes we need to move ahead of the spec. If there's a reason not to wait a few extra weeks in this case, then please at least use a prefix.
>>>>
>>>> Cheers,
>>>> Maciej
>>>>
>>>> On Sep 30, 2012, at 6:32 PM, Kentaro Hara <haraken at chromium.org> wrote:
>>>>
>>>>> TL;DR: Would it be OK to implement constructors for DOM4 Events in
>>>>> WebKit without waiting for the spec?
>>>>>
>>>>>
>>>>> == Background ==
>>>>>
>>>>> Events should have constructors. 'new XXXEvent()' is much easier than
>>>>> 'e = document.createEvent(...); e.initXXXEvent(_a_lot_of_arguments_)'.
>>>>> We have already implemented constructors for a bunch of Events such as
>>>>> Event, CustomEvent, ProgressEvent, etc [5]. However, we have not yet
>>>>> implemented constructors for DOM4 Events (i.e. UIEvent, MouseEvent,
>>>>> KeyboardEvent, WheelEvent, TextEvent, CompositionEvent) because they
>>>>> are not yet speced.
>>>>>
>>>>> Recently PointerEvent was speced with [Constructor] [2]. Considering
>>>>> that PointerEvent inherits MouseEvent, now we want to support
>>>>> [Constructor] on MouseEvent
>>>>> too. In terms of implementation, it is possible to implement
>>>>> [Constructor] on PointerEvent without implementing [Constructor] on
>>>>> MouseEvent. However, implementing [Constructor] on both PointerEvent
>>>>> and MouseEvent would be best.
>>>>>
>>>>> == Rationale for implementing constructors for DOM4 Events ==
>>>>>
>>>>> I have been discussing this topic for one year, in www-dom@ [4] and a
>>>>> www.w3.org bug [3]. It looks like there is a consensus on introducing
>>>>> constructors for DOM4 Events. However, the spec is still a draft [1]
>>>>> and the www.w3.org bug [3] is marked as LATER. Last week I discussed
>>>>> the timeline of the spec with Jacob Rossi (a.k.a. a spec author of
>>>>> PointerEvent and DOM4 Events). According to him:
>>>>>
>>>>> - Their primary focus is on finishing DOM3 Events first.
>>>>> - With DOM3 Events in Candidate Recommendation, they are going to
>>>>> start working on the DOM4 Events. They will discuss it in TPAC.
>>>>> - They will introduce constructors to DOM4 Events.
>>>>>
>>>>> In summary, constructors for DOM4 Events are going to be speced, but
>>>>> it will take time. So I would like to implement them in WebKit a bit
>>>>> ahead of the spec (and thus implement PointerEvent constructors too).
>>>>> If you have any concern, please let me know.
>>>>>
>>>>>
>>>>> == References ==
>>>>> [1] The spec draft by Jacob Rossi:
>>>>> http://html5labs.interoperabilitybridges.com/dom4events/
>>>>>
>>>>> [2] The spec of Pointer Events:
>>>>> http://www.w3.org/Submission/pointer-events/
>>>>>
>>>>> [3] www.w3.org bug:
>>>>> https://www.w3.org/Bugs/Public/show_bug.cgi?id=14051
>>>>>
>>>>> [4] Discussion on www-dom@:
>>>>> http://lists.w3.org/Archives/Public/www-dom/2011OctDec/0081.html
>>>>> http://lists.w3.org/Archives/Public/www-dom/2012JanMar/0025.html
>>>>>
>>>>> [5] WebKit bug:
>>>>> https://bugs.webkit.org/show_bug.cgi?id=67824
>>>>>
>>>>>
>>>>> --
>>>>> Kentaro Hara, Tokyo, Japan (http://haraken.info)
>>>>> _______________________________________________
>>>>> webkit-dev mailing list
>>>>> webkit-dev at lists.webkit.org
>>>>> http://lists.webkit.org/mailman/listinfo/webkit-dev
>>>>
>>>> _______________________________________________
>>>> webkit-dev mailing list
>>>> webkit-dev at lists.webkit.org
>>>> http://lists.webkit.org/mailman/listinfo/webkit-dev
>>>
>>>
>>>
>>> --
>>> Kentaro Hara, Tokyo, Japan (http://haraken.info)
>>
>>
>>
>> --
>> Kentaro Hara, Tokyo, Japan
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo/webkit-dev
>



-- 
Kentaro Hara, Tokyo, Japan


More information about the webkit-dev mailing list