Closed pyramation closed 5 years ago
No, I'm unaware of anything like this.
If you're willing to implement [toJSON method](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior), I'm willing to take pull requests. I think it would make sense to add toJSON
to StyleSheet and perhaps CSSRule.
I have a use case to serialize the "state" of the
CSSOM.Stylesheet
, not sure if this would be something useful, but I have working a gist here that exportsCSSOM2JSON
andJSON2CSSOM
:https://gist.github.com/pyramation/3bafcff80a4fc41b04af8834a2a0d794
Is this something that I am unaware of that already exists? I wanted to be able to write out to a JSON, and then read it back in and have a legitimate
CSSOM
object to work with