How do I ignore style properties in js?

I am doing some work on the CSS / JS plugin. I want to write something like this in my stylesheet:

.whatever { background: -custom-renderer("ctx.beginPath(); ctx.moveTo(0, 40); ctx.lineTo(240, 40); ctx.moveTo(260, 40); ctx.lineTo(500, 40); ctx.moveTo(495, 35); ctx.lineTo(500, 40); ctx.lineTo(495, 45);") repeat-x; background: rgb(30, 30, 30); /* fallback */ 

I will need to access this property using Javascript and rewrite it with another property. Now the problem is that all the methods that I know ( document.styleSheets[1].cssRules , document.defaultView.getMatchedCSSRules , etc.) tend to show only the return property (which is usually great behavior).

0
source share
1 answer

Why don't you add the modified CSS rules as the " <style> " element to the head of the document.

Take a look at this.

http://jonraasch.com/blog/javascript-style-node

* you can set the id in the " <style> " element to easily change it using javascript

0
source

All Articles