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

bzbarsky 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>.

I think heycam's idea is a lot clearer and less magical.  Explicitly instantiate the dictionary type involved (e.g. by doing https://heycam.github.io/webidl/#es-to-dictionary with `V` set to `null` and the relevant dictionary type being used.  Then explicitly call the guts of the relevant interface's constructor.

-- 
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 14:19:09 UTC