Make relative css imports absolute to allow loading from blobs #323
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
@importstatement 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