-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
events: improve argument handling, start passive #33637
events: improve argument handling, start passive #33637
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this might be spec compliant it's not ideal to allow this. It'll hide potential bugs.
@BridgeAR I see your point and thank your for championing developer experience and (what I consider) good default behavior for passing invalid arguments. I don't think it's our place to make this call if we ship This PR is a prerequisite for running (and passing) the WPTs for events. If you feel strongly about diverging from the spec here - I am fine with making I feel people generally would expect an I think we are probably going to find more fundamental issues with EventTarget (like the error handling behavior, where I would particularly value your opinion and feedback) - and we should probably pick our battles here if/when we want to diverge from the spec or ask for it to be amended. |
@BridgeAR I checked with Anne on IRC, it sounds like emitting a warning is allowed from a spec point of view. Would that address your concern? (for reference here is my conversation with Anne)
|
@BridgeAR I've updated the code to emit a warning on incorrect usage, PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like it for the same reasons as @BridgeAR but... Ok
@benjamingr thanks for adding the warning. I agree that there might be more issues that we find and we should probably open a tracking issue for things where we believe the user experience is not ideal. That way it would be easier to determine what we could/should bring up to discuss to improve in the spec itself. |
706cd34
to
73058fb
Compare
8ae28ff
to
2935f72
Compare
73058fb
to
e985ec7
Compare
@jasnell this was out of sync, rebased this and the others |
Any chance we could use a different submodule prefix for EventTarget? I always get confused whether these commits are regarding event emitter or event target... especially since the description often can at least partly apply to either. |
Closing in favor of #34015 (which combines this and other |
Hey, this PR fixes argument handling for cases like
addEventListener('foo', undefined)
which is allowed as well as add a whatwg WPT test that tests this.Note the actual passive tests don't pass (because we don't deal with passive).
IIUC passive means "if event.preventDefault is called from within a passive listener - don't preventDefault". I will make a PR fixing this after #33613 lands.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes