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

Conversation

@jamesnw
Copy link
Contributor

@jamesnw jamesnw commented Apr 18, 2025

Description

This provides partial support for rules in CSS Imports.

Currently, when the polyfill re-writes a stylesheet and loads it as a blob, any relative URLs in an @import statement will not be able to be loaded.

This change rewrites the URL to be absolute, based on document.baseURI, so that styles from imported stylesheets are applied.

This change does NOT parse imported stylesheets for anchor positioning declarations.

It also does not convert urls in imported stylesheets, but this shouldn't be a problem, as they should still be able to load content from a relative URL.

Alternate Approach

This is an exploration to one approach for handling the broken relative URLs. The alternate approach is to inject the styles into the document directly, rather than as links.

Related Issue(s)

Fixes #274, Fixes #314

Steps to test/reproduce

https://deploy-preview-323--anchor-polyfill.netlify.app/#imports

@netlify
Copy link

netlify bot commented Apr 18, 2025

Deploy Preview for anchor-polyfill ready!

Name Link
🔨 Latest commit a06dfb9
🔍 Latest deploy log https://app.netlify.com/sites/anchor-polyfill/deploys/680279300d05db0007bf289e
😎 Deploy Preview https://deploy-preview-323--anchor-polyfill.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Apr 18, 2025

Deploy Preview for anchor-position-wpt canceled.

Name Link
🔨 Latest commit a06dfb9
🔍 Latest deploy log https://app.netlify.com/sites/anchor-position-wpt/deploys/68027930cdd5460008caa6e7

@jamesnw
Copy link
Contributor Author

jamesnw commented Apr 21, 2025

We are initially going to try the approach in #324, but may revisit if testing by users reveals any reasons to favor this instead.

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.

[BUG] CSS imports not working with 0.5.1 [BUG] The polyfill causes @font-face rules to be ignored

2 participants