Skip to content

swap-high strategy probably requires the as attribute #158

@AioiLight

Description

@AioiLight

else if (preloadMode === 'swap-high') {
// @see http://filamentgroup.github.io/loadCSS/test/new-high.html
link.setAttribute('rel', 'alternate stylesheet preload')
link.setAttribute('title', 'styles')
link.setAttribute('onload', `this.title='';this.rel='stylesheet'`)
noscriptFallback = true
}

https://html.spec.whatwg.org/multipage/semantics.html#attr-link-as

Currently, using swap-high will output a link tag without an as attribute. This may result in invalid preloading.

In Firefox, it will explicitly log to the console that preloading is disabled.

IMO preloading does not require alternate stylesheet values and title attributes, rel="preload" and as="style" seem sufficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions