Skip to content
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

Drop some top-level events from the list #11912

Merged
merged 2 commits into from
Jan 11, 2018

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Dec 22, 2017

Since they never bubble it doesn't seem necessary to keep them in the top-level list?
We already don't put other events like submit there for the same reason.

I haven't verified this works in practice, but I'd expect it to.
Or at the very least we should clarify the comment that explains the criteria for inclusion.

topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This one also fires for JS errors and images (not just media) but AFAIK it doesn't truly bubble either way.

Copy link
Contributor

@nhunzaker nhunzaker Jan 11, 2018

Choose a reason for hiding this comment

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

Correct. It does not fire bubble for images, iframes, videos, or audio tags.

But it does capture. We might be able to attach them at the top level using capture to avoid eagerly attaching a listener to each element.

@gaearon
Copy link
Collaborator Author

gaearon commented Dec 22, 2017

Tagged you folks for review but it's nothing urgent :-) Have good holidays.

@gaearon
Copy link
Collaborator Author

gaearon commented Dec 22, 2017

     "react-dom.production.min.js (UMD_PROD)": {
-      "size": 93699,
-      "gzip": 30755
+      "size": 93218,
+      "gzip": 30555
     },

Copy link
Contributor

@aweary aweary left a comment

Choose a reason for hiding this comment

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

LGTM assuming this works as expected. We should add some media event fixtures at some point 📺

trapBubbledEvent(event, mediaEvents[event], domElement);
for (const event in mediaEventTypes) {
if (mediaEventTypes.hasOwnProperty(event)) {
trapBubbledEvent(event, mediaEventTypes[event], domElement);
Copy link
Contributor

Choose a reason for hiding this comment

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

trapBubbledEvent is kind of a confusing name now since it's attaching the listener directly to the event target in some cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. It's more like "attach this event locally to emulate bubbling"

@facebook facebook deleted a comment from ka7iu Jan 2, 2018
@facebook facebook deleted a comment from ka7iu Jan 2, 2018
@gaearon
Copy link
Collaborator Author

gaearon commented Jan 5, 2018

Anybody wants to help test this in browsers? 😄

@nhunzaker
Copy link
Contributor

Sorry, should have said something. I was going to create a fixture for this. But I can get on some browser testing stuff too.

@gaearon
Copy link
Collaborator Author

gaearon commented Jan 5, 2018

Nice, thanks! I'll leave this to you then.

@gaearon gaearon requested review from nhunzaker and removed request for nhunzaker and jquense January 5, 2018 19:25
@nhunzaker
Copy link
Contributor

Just checking back. We merged the media event fixtures. Next step is to rebase those into this branch and run the tests real quick.

I was planning on doing that, but no worries if someone else can get to it before me.

@nhunzaker
Copy link
Contributor

Rebased master and verified this in the DOM fixtures. The dog approves:

screen shot 2018-01-11 at 6 37 44 pm

@nhunzaker nhunzaker merged commit 73fa26a into facebook:master Jan 11, 2018
@gaearon gaearon deleted the drop-top-events branch January 11, 2018 23:47
@gaearon
Copy link
Collaborator Author

gaearon commented Jan 11, 2018

Thank you!

@@ -18,7 +18,7 @@ import {
import SyntheticEvent from 'events/SyntheticEvent';
import invariant from 'fbjs/lib/invariant';

import BrowserEventConstants from '../events/BrowserEventConstants';
import {topLevelTypes} from '../events/BrowserEventConstants';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops I think this might not be enough now? We need to do the same for mediaEventTypes or we'll "lose" some events?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah man. I think you're right. Darn.

ManasJayanth pushed a commit to ManasJayanth/react that referenced this pull request Jan 12, 2018
* Drop some top-level events from the list

* Put both whitelists in one file
@gaearon gaearon mentioned this pull request Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants