From cdbb1a8ee729331d4155d1ccfa6bdf9b69a7e5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Tue, 22 Nov 2022 18:21:17 +0100 Subject: [PATCH] variant: fix generator for use of neon #401 --- static/js/variant.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/static/js/variant.js b/static/js/variant.js index a26a36a0cf..19a9deafac 100644 --- a/static/js/variant.js +++ b/static/js/variant.js @@ -326,20 +326,27 @@ var variants = { }, findLoadedStylesheet: function( id ){ - var style = null; for( var n = 0; n < document.styleSheets.length; ++n ){ if( document.styleSheets[n].ownerNode.id == id ){ var s = document.styleSheets[n]; - for( var m = 0; m < s.rules.length; ++m ){ - if( s.rules[m].selectorText == ':root' ){ - style = s.rules[m].style; - break; + if( s.rules && s.rules.length ){ + for( var m = 0; m < s.rules.length; ++m ){ + if( s.rules[m].selectorText == ':root' ){ + return s.rules[m].style; + } + if( s.rules[m].cssRules && s.rules[m].cssRules.length ){ + for( var o = 0; o < s.rules[m].cssRules.length; ++o ){ + if( s.rules[m].cssRules[o].selectorText == ':root' ){ + return s.rules[m].cssRules[o].style; + } + } + } } } break; } } - return style; + return null; }, changeColor: function( c, without_prompt ){