-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Fix #21972: Add onResize
event to video elements
#21973
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ Array [ | |
"progress", | ||
"rateChange", | ||
"reset", | ||
"resize", | ||
"scroll", | ||
"seeked", | ||
"seeking", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,9 @@ export const mediaEventTypes: Array<DOMEventName> = [ | |
'waiting', | ||
]; | ||
|
||
// List of events that need to be individually attached to video elements. | ||
export const videoEventTypes: Array<DOMEventName> = ['resize']; | ||
|
||
// We should not delegate these events to the container, but rather | ||
// set them on the actual target element itself. This is primarily | ||
// because these events do not consistently bubble in the DOM. | ||
|
@@ -216,6 +219,7 @@ export const nonDelegatedEvents: Set<DOMEventName> = new Set([ | |
// and can occur on other elements too. Rather than duplicate that event, | ||
// we just take it from the media events array. | ||
...mediaEventTypes, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell it was unused. Perhaps there could be a future conflict if a Synthetic Event was created for the Window:resize event? It seems safe to me for now, but let me know if there are any further tests you’d like me to run. |
||
...videoEventTypes, | ||
]); | ||
|
||
function executeDispatch( | ||
|
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.
Note: I created a separate
videoEventTypes
array, since I doubt anyone will want to addonResize
to an audio event. It would simplify the code a bit to just addresize
to themediaEventTypes
array, if that’s preferred.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.
A one-item array seems like overkill to me. Are there any downsides to adding it to
mediaEventTypes
? I'd suggest that.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.
Happy to make the change! The only “downside” is that since the
resize
event spec lists:in its preconditions, we might want to log a warning if someone attaches
onResize
to anaudio
element. But I agree, I think the simplification is worth it. I’ll make the change now.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.
Done ✨