EDIT: This couldn't be a duplicate of Change the :before selector from javascript as I'm trying to insert a rule and not to update an existing one. So for anyone searching for the the same problem of insertingRules with this error wont find the suggested duplicate! I didn't and it doesn't necessarily help! END EDIT!
I'm trying to insert a webkit specific rule into a css file through javascript. The rule I am trying to insert is:
progress[value]::-webkit-progress-value:after{background-color: rgba(255,255,255,0.7);}
What the browser doesn't accept is the :after
selector. Is there another way to target this specific rule including :after
?
I'm inserting the css this way which works fine for all other rules I have. Its only this one that fails!
var sheet = document.styleSheets[2], index = 0;
sheet.insertRule('progress[value]::-webkit-progress-value:after{background-color: rgba(255,255,255,0.7);}', index);