Skip to content
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

Replace document.fonts.load with check #111

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

doriansmiley
Copy link

We use this lib in several projects and were getting a lot of timeouts for fonts that actually did load. After fixing several issues related to the handling of the returned promise I still found that in browsers that natively support the font loading API there were issues. After evaluating the code the most likely culprit appeared to be document.fonts.load. Replacing with check resolved our issues. However I wan only able to run our tests against the revised lib. When I ran grunt test I got some errors about not being able to execute phatomJS. So you'll want to test this change.

document.fonts.load was failing to return. I think it may have to do with the resolution of promises but check works perfectly.
@HunterLarco
Copy link

+1 also having this issue. It looks like load will force a unique font load for every time it's called, resulting in loading a single font family many times over. Right now this bug increases our network traffic by ~14 MB.

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.

2 participants