I know document.styleSheets
which consists of all valid style sheets in a page. I want to know whether i can create a new one and append it to present list via javascript.
I have tried document.styleSheets[0].constructor
, document.styleSheets[0].__proto__.constructor
, new CSSStyleSheet
, CSSStyleSheet()
, all what i get from Chrome is TypeError: Illegal constructor
. CSSStyleSheet.constructor()
returned a pure object but i expect a CSSStyleSheet object.
I know i can create a link/style element and append it, then modify it. What i want to know is that, can i create such object directly with javascript?