Is it possible to change a CSSRule‘s .selectorText from javascript ? MDN says it is a getter/setter but setting it seems to have no effect…
references :
selectorText() gets/sets the textual representation of the selector for the rule set.
Edit :
well all the “docs” are wrong and misleading.
http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule
attribute DOMString selectorText;
// raises(DOMException) on setting
No, it appears indeed that the browser implementation (at least in Firefox) opts to choose these as readonly (as is apparently allowed per the spec by the fact that
selectorText(andcssTextas well) can throw “NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.”).You can, however, modify the style property:
You can, however, get by without parsing CSS, by creating and inserting
<style>tags whoseinnerHTMLyou set.