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

Better handling of stylesheet links that have disabled and/or media #246

Open
tuespetre opened this issue Sep 13, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@tuespetre
Copy link
Contributor

tuespetre commented Sep 13, 2024

The issue:

  • The browser will not load stylesheets from links with the disabled attribute.
  • The polyfill currently will load such links, and if any changes are applied, replace them with new links without disabled
  • Even if the polyfill is modified to preserve disabled, it might not be desirable to fetch the resource in the first place. (fixed in Do not fetch disabled links, but copy over all attributes to new link. #262)
  • The same might be said for links with a media attribute when the media query is not currently satisfied.

My rough idea to address the issue is basically this:

  • For any stylesheet link that the polyfill would process:
    • Check if it is disabled. If so, add a MutationObserver with { attributeFilter: ['disabled'] } that will handle processing the stylesheet if it were to become no longer disabled.
    • Check if it has media, and if so, create a MediaQueryList. If the media query list does not match, add an event listener for its change event that will handle processing the stylesheet if it were to become applicable according the media query.
@tuespetre tuespetre added the enhancement New feature or request label Sep 13, 2024
@jgerigmeyer jgerigmeyer changed the title Handling stylesheet links that have disabled and/or media Better handling of stylesheet links that have disabled and/or media Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant