-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
[BUG] The polyfill causes @font-face rules to be ignored #274
Comments
Thanks for the reproduction! A quick diff shows that the polyfilled stylesheet is removing a crucial space-
We'll need to take a look to see why that's happening. |
Hmm, in that case, my current guess is that there is an issue with loading self-hosted fonts from Before the polyfill runs, accessing I'm not finding anything about loading fonts from blobs, but it seems possible that this would be blocked from a security standpoint. If it's not that, it could be related to this section of the spec- https://drafts.csswg.org/css-font-loading/#font-face-css-connection. |
I'm pretty sure what's going on here is that relative URLs don't work when used in a blob source. (See: https://stackoverflow.com/questions/37657103/load-local-webfonts-from-blob-loaded-stylesheet) I don't know if there's a good way for the polyfill to replace relative URLs with absolute URLs? Or if we should look into a non-blob way to inject the polyfilled styles. |
Interesting point! I guess it makes sense for the browser to consider that inside a blob file, there is not really a context on which it can rely to compute targeted URLs from relative URLs. Is there any reason for the polyfill to use blob instead of a <style> element? The result might not be the same? |
Describe the bug
When @font-face rules are in CSS sources that are parsed by the polyfill, it seems like the navigator does not load them again after the CSS have been re-injected in the blob source. Please not that the bug is present only with self-hosted fonts.
To Reproduce
Example to reproduce here: https://projects.c-mh.fr/anchor-polyfill-font-bug/
Expected behavior
The loaded fonts needs to be still displayed.
Browsers tested on
Chrome (by forcing polyfill execution) and Firefox.
Possible workaround
For now, I have declared my fonts in a separate CSS file that won't be parsed by the polyfill, but in my case, it's not an ideal solution.
The text was updated successfully, but these errors were encountered: