fix: use addListener instead of addEventListener to to observe media query lists#121557
Merged
alexdima merged 2 commits intomicrosoft:mainfrom May 12, 2021
Merged
fix: use addListener instead of addEventListener to to observe media query lists#121557alexdima merged 2 commits intomicrosoft:mainfrom
alexdima merged 2 commits intomicrosoft:mainfrom
Conversation
2f9d214 to
03f14bc
Compare
glaukiol1
approved these changes
Apr 29, 2021
glaukiol1
left a comment
There was a problem hiding this comment.
Simple fix, thanks for contributing! Approved by me
alexdima
requested changes
Apr 30, 2021
Member
alexdima
left a comment
There was a problem hiding this comment.
I cannot accept the PR as is. MDN strongly discourages using addListener. At least this should be done that it first checks if addEventListener exists and if not, then fall back to addListener.
https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener
lists Prior Safari 14, MediaQueryList does not have method addEventListener, use addListener for backward compatibility, which is supported by all browsers. fixes microsoft/monaco-editor#2432
03f14bc to
db5cb92
Compare
alexdima
approved these changes
Apr 30, 2021
Member
alexdima
left a comment
There was a problem hiding this comment.
LGTM. We are currently locking down our main for the upcoming vscode release, I will merge this early next week.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Prior Safari 14, MediaQueryList does not have method addEventListener,
use addListener for backward compatibility, which is supported by all browsers.
This PR fixes microsoft/monaco-editor#2432