cssRules object is missing css rules

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



cssRules object is missing css rules



I've got a "style" element with this rule:


#canvas
position:absolute;
z-index:100;
left:0;
top:0;
background-color: none;
border: none;
width:300px;
height:250px;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
overflow:hidden;



now if i'm trying to access its css rules via:


StyleElem.sheet.cssRules[0].cssText



i'm getting:


#canvas position: absolute; z-index: 100; left: 0px; top: 0px; border: none; width: 300px; height: 250px; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); overflow: hidden;



now as you can see some rules has dissapeared like:
background-color
-moz-user-select: none;
-webkit-user-select: none;
........
any idea why? and how to fix that?





Curious, do these options show up if you use a browser that requires them? It is possible those options get optimized out of the css since your browser most likely understands user-select: none;
– Christian Scillitoe
Aug 8 at 12:09



user-select: none;





I agree with @ChristianScillitoe and you can put a random background color to see if it appears.
– Torjescu Sergiu
Aug 8 at 12:10





the browser ignores rules that do not pertain to it.
– Andrew Killen
Aug 8 at 12:13





background-color: none; - that’s not a valid color.
– CBroe
Aug 8 at 12:14


background-color: none;





@ChristianScillitoe you're right , when i changed the background-color it reappeared in the cssRules. but i'm actually needs to access all rules like this because i'm using the browser parser to parse css from text and extract the rules and i'm loosing those rules like that, any suggestions?
– avi dahan
Aug 8 at 12:15









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered