这是indexloc提供的服务,不要输入任何密码
Skip to content

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

@tuespetre

Description

@tuespetre

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions