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

Polyfill #19

Open
lukewarlow opened this issue Sep 8, 2023 · 1 comment
Open

Polyfill #19

lukewarlow opened this issue Sep 8, 2023 · 1 comment

Comments

@lukewarlow
Copy link
Collaborator

lukewarlow commented Sep 8, 2023

Just a quick note on how much of this could be polyfilled for older browsers.

Can be polyfilled:

  • window.matchMedia (by overriding the function),
  • <link media="..." rel="stylesheet"> (using the disabled attribute)
  • <link href="..." media="..." rel="icon"> (modifying the href attribute)
  • <meta name="theme-color" media="..." content="..."> (modifying the name attribute)
  • <source media="..." type="..."> (modifying the type attribute)
  • <meta name="color-scheme" content="..."> (overriding the content attribute)
  • color-scheme CSS property (by overriding the CSS property value)

Cannot be polyfilled:

  • @media (...) { ... } (CSS media queries cannot always be polyfilled)
  • @import (...) media-query-list (CSS imports cannot be polyfilled)
  • User Preference Client Hints (Client Hints are forbidden headers)

Unfortunately @media is one of the main benefits of this API.

@lukewarlow
Copy link
Collaborator Author

Based on https://github.com/GoogleChromeLabs/container-query-polyfill it may be possible to transpile the preference media queries for <style> and same-origin <link> elements

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

No branches or pull requests

1 participant