stylesheet variable is undefined in Chrome
See original GitHub issueGot this error when tried to use forceFitColumns
option in Chrome (v 14.0.835.202 m)
Apparently, appending <style>
to <head>
does not add the CSSStyleSheet
object to document.styleSheets
, and findCssRule(selector)
fails because stylesheet
variable is undefined.
Checked, it works in Opera and IE, so looks like a Chrome bug, didn’t find a good solution…
Issue Analytics
- State:
- Created 12 years ago
- Comments:50 (10 by maintainers)
Top Results From Across the Web
CSS Undefined Variable Checker
A Devtools extension that detects usages of undefined CSS variables.
Read more >Are CSS Custom Properties not available to pseudo elements?
At the head of my page, I have a bunch of CSS Custom Properties that ... pseudo-elements, Chrome states that the variable is...
Read more >Why are my variables undefined when using `Debugger` in ...
Basically, there's a bit of optimization happening behind the scenes and Chrome does some extra clean up if the variables aren't within a...
Read more >3 things about CSS variables you might not know
So, using an undefined variable won't lead to a parsing error, it won't prevent your stylesheet to load or parse or render.
Read more >Chrome dev tools consider variable undefined - Sololearn
Why is it that the chrome debugger shows undefined when I declare my javascript variables with let but not var?
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
While dynamically creating style and style rule via text node, Google Chrome does not add stylesheet to document.styleSheets immediately. As dynamic stylesheet doesn’t exist getColumnCssRules() throws “Cannot find stylesheet.” exception. To fix this I have added css rule vai JS. This works on (chrome,firefox and IE)
Modify createCssRules() and add new function addCSSRule. addCSSRule force browser to create stylesheet under document.styleSheets.
Thanks Maheshkumar !!! It resolved my issue…