Skip to content

Conversation

@annevk
Copy link
Member

@annevk annevk commented Aug 14, 2017

@RByers what do you think?


Preview | Diff

<code>{{EventListenerOptions/capture}}</code>.

<li><p>Return <var>capture</var>.
<li><p>Return <var>options</var>'s <code>{{EventListenerOptions/capture}}</code>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks nice (not sure why I thought the extra text was useful - sorry).

dom.bs Outdated
interface EventTarget {
void addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options);
void removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
void addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = false);
Copy link
Contributor

@RByers RByers Aug 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why make this change?

IIRC we discussed this on my original PR. I could dig up the history but perhaps the argument against it was that it was observably identical to not specifying any default and instead relying on the dictionary defaults? If behavior is indeed identical with or without this change, then I'd prefer we leave it out - the meaning when named options seems more explicit. Also since we're now doing spec/impl IDL diffing, we'd want to get all the implementations to update which seems silly if there's no behavior difference whatsoever.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way we don't have to set the default value in prose. For some reason we didn't spot this solution in the original PR and we had all the defaults in prose and therefore I argued to not have them in IDL: #82 (diff).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, maybe this isn't needed because omitting the argument means an implicit dictionary gets passed. I'm not a 100% sure that's also true if the dictionary is part of a union, but it'd make sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, that's what happens: https://heycam.github.io/webidl/#es-union. Okay, I'll revert the IDL changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, exactly. Our implementation also works that way too - getting the dictionary defaults automatically from the bindings generator, not explicitly in code (ignoring, for now, our special treatment of passive).

@annevk annevk merged commit cd3bcae into master Aug 17, 2017
@annevk annevk deleted the annevk/EventListenerOptions branch August 17, 2017 16:38
@annevk
Copy link
Member Author

annevk commented Aug 17, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants