Alias mobile browsers to the desktop version#371
Merged
ai merged 3 commits intobrowserslist:masterfrom May 14, 2019
nicolo-ribaudo:mobile-alias
Merged
Alias mobile browsers to the desktop version#371ai merged 3 commits intobrowserslist:masterfrom nicolo-ribaudo:mobile-alias
ai merged 3 commits intobrowserslist:masterfrom
nicolo-ribaudo:mobile-alias
Conversation
ai
reviewed
May 11, 2019
test/direct.test.js
Outdated
| }) | ||
|
|
||
| it('supports Can I Use missing mobile versions', () => { | ||
| expect(browserslist('chromeandroid 53')).toEqual(['and_chr 53']) |
Member
|
We need to do it only on a special option. I can’t release major version (because many old projects are using Browserslist and they will not update it for years). As result, we can’t break API. |
nicolo-ribaudo
commented
May 11, 2019
| expect(browserslist('chromeandroid 53')).not.toEqual(['and_chr 53']) | ||
| expect(browserslist('and_ff 60')).not.toEqual(['and_ff 60']) | ||
| expect(() => browserslist('ie_mob 9')).toThrow() | ||
| expect(() => browserslist('op_mob 30')).toThrow() |
Contributor
Author
There was a problem hiding this comment.
I don't know why some of these browsers throw and some resolve to another version, but it's the current behavior:
- IE throws: https://browserl.ist/?q=ie_mob+9
- Chrome resolves to a wrong versoin: https://browserl.ist/?q=and_chr+53
Member
There was a problem hiding this comment.
Yeap, error is throwing because Can I Use doesn't have info
Member
|
Can you add additional option here https://github.com/browserslist/browserslist#js-api |
Contributor
Author
|
Thanks! |
Member
|
@nicolo-ribaudo do you have a Twitter account to mention you in release tweet? |
Member
|
Released in 4.6 |
Contributor
Author
|
Yup, it's @NicoloRibaudo |
zhouyu9527
pushed a commit
to zhouyu9527/browserslist
that referenced
this pull request
Jul 5, 2022
* Alias mobile browsers to the desktop version * Add mobileToDesktop option * Documentation
tats-u
pushed a commit
to tats-u/browserslist
that referenced
this pull request
Apr 8, 2023
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #367
In this PR, browserslist fallback to the desktop version only if the query doesn't match a mobile version. I didn't choose to always fallback in case a mobile browser has a release which doesn't match its desktop counterpart (is it even possible?).