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

Fix feature support queries with mobileToDesktop #767

Merged
merged 2 commits into from Jun 12, 2023

Conversation

steverep
Copy link
Contributor

Fixes #761 by adding support for mobileToDesktop to feature queries.

  • Changed the feature cache to a 2 dimensional object for each browser and version to make the implementation much simpler
  • Uses existing function to get the mobile to desktop data
  • Only looks to the desktop version's support data when (a) there is no mobile data and (b) the feature is supported by the latest mobile version
  • Added a couple specific mobile to desktop tests and made the others more specific for the common data

Note the way the existing tests were messing with the cache property doesn't really work. This is evident if you just try to use the same feature from one test to the next (the first cache setting is always used). I didn't bother to try to make it work because I think it would involve exporting the cache itself, so I just removed some of that and use a different feature for each test.

@Semigradsky
Copy link
Contributor

Just a reminder that need to change typings also:

browserslist/index.d.ts

Lines 125 to 129 in 312d763

let cache: {
[feature: string]: {
[name: string]: 'y' | 'n'
}
}

@steverep
Copy link
Contributor Author

Done. I changed the type to just string as there are more possibilities than just "y" or "n".

@ai ai merged commit 640a7ab into browserslist:main Jun 12, 2023
7 checks passed
@ai
Copy link
Member

ai commented Jun 12, 2023

Thanks! Released at 4.21.8.

@steverep steverep deleted the features-for-mobile-to-desktop branch June 12, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mobile-to-desktop option is negated by feature support
3 participants