- From: David Flanagan <dflanagan@mozilla.com>
- Date: Fri, 01 Jul 2011 13:43:45 -0700
- To: www-dom@w3.org
- Message-ID: <4E0E3181.5080007@mozilla.com>
This new event initialization system is really nice. I've got a few comments below. > When an event constructor is invoked these steps must be run: > > 1. > > Create a new event > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-event> > that uses the interface > <http://dev.w3.org/2006/webapi/WebIDL/#dfn-interface> the > constructor was invoked upon. > > 2. > > Set its initialized flag > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#initialized-flag>. > > > 3. > > Initialize the |type > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-event-type>| > attribute to the type argument. > > 4. > > If there is an eventInitDict argument then for each dictionary > member > <http://dev.w3.org/2006/webapi/WebIDL/#dfn-dictionary-member> > defined therein find the attribute on event > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-event> > whose identifier > <http://dev.w3.org/2006/webapi/WebIDL/#dfn-identifier> matches the > key of the dictionary member > <http://dev.w3.org/2006/webapi/WebIDL/#dfn-dictionary-member> and > then initialize the attribute to the value of that dictionary > member <http://dev.w3.org/2006/webapi/WebIDL/#dfn-dictionary-member>. > > 5. > > Return the event > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-event>. > > You should swap the order of steps 3 and 4, or include text in step 4 excluding dictionary members named "type". Should this algorithm also set isTrusted? That attribute actually seems overspecified currently. initEvent() sets it explicitly, and there is text that says that it must be initialized to false, and it is also set explicitly by dispatchEvent() even though it is readonly. Does this spec need to say something about when isTrusted is true? > When the |createEvent(eventInterfaceName)| methed is invoked these > steps must be run: > > 1. > > If eventInterfaceName is an ASCII case-insensitive > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#ascii-case-insensitive> > match for any of the strings in the first column in the following > table, let eventInterfaceName be the string in the second column > on the same row as the matching string: > > Input interface Replacement interface > "|htmlevents|" "|event|" > "|mouseevents|" "|mouseevent|" > "|mutationevents|" "|mutationevent|" > "|uievents|" "|uievent|" > > 2. > > If eventInterfaceName is /not/ an ASCII case-insensitive > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#ascii-case-insensitive> > match for "|event|" or for the name of an interface that inherits > from the |Event > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event>| > interface and is supported by the user agent, throw a > |NOT_SUPPORTED_ERR > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-not_supported_err>| > and terminate these steps. > > 3. > > Create an event > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-event> > implementing the interface whose name eventInterfaceName is an > ASCII case-insensitive > <http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#ascii-case-insensitive> > match for and return it. > > Step 2 should probably only succeed if it is the name of an interface that inherits from Event and defines an initEvent() method, right? Hixie said he plans to remove the initEvent() methods for whatever event interfaces he can. If he does that, it will probably require changes to the table in step 1.
Received on Friday, 1 July 2011 20:44:25 UTC