Firefox: InvalidAccessError when checking if stylesheet has been imported
See original GitHub issueAfter having tweaked my build system I get an error in Firefox only: “InvalidAccessError: A parameter or an operation is not supported by the underlying object”.
The error is related to react-utils.js line 99:
var styleSheet = document.styleSheets[i];
var CSSRulesList = styleSheet.rules || styleSheet.cssRules;
Trying to access styleSheet.cssRules makes Firefox crash; uncommenting this line (and the next ones) fixes the problem.
The error is probably rare, because it’s all about timing, e.g. if you set a breakpoint at the mentioned line you won’t get the error. So it only happens if you load a chart as one of the first things of your app. In my case the app is just being build…
So it’s probably more of an edge case. However, the code in question only tries to warn the user.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Javascript Firefox - Unable to query cssRules if @import is ...
I am unable to query cssRules if @import is present in css stylesheet. Is it expected as per web standard? Or it's know...
Read more >Firefox won't load CSS for local website - Mozilla Support
My site loads perfectly fine in other browser, just not Firefox. I have a local website with a style sheet that is saved...
Read more >Mozilla Firefox Release Notes
786891, Add capability to auto-prefix modules to python script that imports css reftests. 803276, Disable typed array move() operator for specific channels.
Read more >DOMException - Web APIs | MDN
Each exception has a name, which is a short "PascalCase"-style string identifying the error or abnormal condition.
Read more >Firefox doesn't load CSS file - Mozilla Support
If i go to the developer console it give me this error (translated): <The character encoding of the HTML document has not been...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To be honest I would just remove the check / warning, because you cannot reliably determine from JS if the user just forgot to include styles:
Do you have so much pain with users that don’t realize that they’ve missed to include the css?
Well that’s no good. I would support an additional PR that marks the check unnessecary via localstorage or a prop on XYPlot called noStylesheetCheck that disables the check if that floats your boat