Re: [whatwg/dom] Editorial: provide a shorthand for other specifications to create events (#347)

heycam commented on this pull request.



> +</ol>
+
+<p>To <dfn export id=concept-event-create lt="creating an event|create an event">create an
+event</dfn> using <var>eventInterface</var>, which must be either {{Event}} or an interface that
+inherits from it, run these steps:</p>
+
+<ol>
+ <li><p>Create a new object <var>event</var> using the <var>eventInterface</var> interface.
+
+ <li><p>Set <var>event</var>'s <a>initialized flag</a>.
+
+ <li><p>For each <a>dictionary member</a> of the dictionary accepted by <var>eventInterface</var>'s
+ constructor (which will either be {{EventInit}} or a dictionary that inherits from it), find the
+ attribute on <var>event</var> whose <a spec=webidl>identifier</a> matches the key of the
+ <a>dictionary member</a> and then set the attribute to the default value of that <a>dictionary
+ member</a>.

What about the event type?

I feel like we should be able to re-use https://dom.spec.whatwg.org/#constructing-events here.  How about factoring out the dictionary initial value bits out of https://heycam.github.io/webidl/#es-dictionary into a separate named algorithm ("default constructed dictionary value" or whatever), then invoking it here:

1. Let *eventDict* be the *eventInterface* interface's associated initializer dictionary [needs a definition].
2. Create a new object *event* using the *eventInterface* interface.
3. Let *init* be a default constructed dictionary value of type *eventDict*.
4. Run the [steps described for all Event interface constructors](https://dom.spec.whatwg.org/#constructing-events), with [what?] as the *type* argument and *init* as the *eventInitDict* argument.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/347

Received on Friday, 21 October 2016 06:28:21 UTC