Re: [dom] Add EventListenerOptions and passive event listeners (#82)

>  method, when invoked, must run these steps:
>  
>  <ol>
>   <li><p>If <var>callback</var> is null, terminate these steps.
>  
> + <li>If <var>options</var> is of type boolean, let <var>capture</var> be
> + <var>options</var> and let <var>passive</var> be false.  Otherwise let
> + <var>capture</var> and <var>passive</var> be the corresponding values in the
> + <var>options</var> {{EventListenerOptions}} dictionary.

Ah, I see what you're saying.  We could leave the default values out and update the spec text to say something like `If <var>options</var> has a <code>capture</code> member with value true, set <var>capture</var> to true'.  The way it's written now ("let capture and passive be the corresponding values in ..." seems to imply that those members will ALWAYS be present).

Personally I prefer the default values because it makes it more explicit that eg. {capture:false} and {} have identical behavior.  But if you think it's better to have the defaults be defined only by the algorithm, that's fine with me too.  I'm curious though, what's the advantage of that?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/82/files#r47792292

Received on Wednesday, 16 December 2015 15:49:57 UTC