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

font rendering not working due to .hasOwnProperty("cssRules") returning false #21

Open
borkdude opened this issue Nov 7, 2019 · 4 comments

Comments

@borkdude
Copy link

borkdude commented Nov 7, 2019

Use case: description, code

I was trying out the latest code from master to get font-awesome rendering fixed. This still didn't work.

Expected behavior

Font awesome fonts are rendered.

Actual behavior (stack traces, console logs etc)

When I execute this in the console:

document.styleSheets[1].hasOwnProperty("cssRules")

I saw that it returned false while it's actually a valid styleSheet object with a cssRules property:

Screenshot 2019-11-07 20 48 04

The relevant line in the code:

if (sheet.hasOwnProperty("cssRules")) {

does this check and that's the reason why no stylesheets are actually embedded.

I believe this check can be omitted anyway because of the try catch that follows?

Library version

Master @ commit d3ee842

Browsers

  • Chrome 78.0.3904.70 (Official Build) (64-bit)
  • Firefox 70.0.1 (64-bit)
@jaredleishman
Copy link

jaredleishman commented Dec 6, 2019

Experiencing this same issue. Removing the if block fixed it for me. Meaning, the fonts were pulled in correctly. With that said, I am still getting errors in the console from the try catch block and it is noticeably slower.

@devsalsa
Copy link

devsalsa commented Oct 1, 2020

if (sheet.hasOwnProperty("cssRules")) { should probably be Object.getPrototypeOf(sheet).hasOwnProperty("cssRules")

@IDisposable
Copy link
Member

I've updated master for this change, will cut a release soon

@IDisposable
Copy link
Member

Hey @borkdude , @jaredleishman ... is this working for you in v2.9.5?

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

No branches or pull requests

3 participants