Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSSStyleSheet.toString() #10

Closed
NV opened this issue Oct 26, 2010 · 7 comments
Closed

CSSStyleSheet.toString() #10

NV opened this issue Oct 26, 2010 · 7 comments

Comments

@NV
Copy link
Owner

NV commented Oct 26, 2010

Ability to serialize CSSStyleSheet object into CSS string.

CSSOM.parse("body {color: black}").toString()
-> "body {color: black}"

It might need a few options, such as indent or propertiesSeparator. Not sure about it yet.

@frank06
Copy link

frank06 commented Nov 19, 2010

Ah, bummer...

Even without indentation, it should be feasible. I believe my usecase (parse/modify/serialize) is common enough to justify having this.

At the moment I can't even inspect it:

var p = CSSOM.parse("body {color: black}")
console.dir(p)

...I get

TypeError: Array.prototype.toString is not generic
    at CSSStyleDeclaration.toString (native)
    at String.STRING_ADD_LEFT (native)
    at isRegExp (sys)
    at format (sys:155:11)
    at sys:186:19
    at Array.map (native)
    at format (sys:162:23)
    at sys:186:19
    at Array.map (native)
    at format (sys:162:23)

@NV
Copy link
Owner Author

NV commented Nov 19, 2010

I can't reproduce TypeError: Array.prototype.toString is not generic in Chrome 9.0.587.0 dev, Safari 5.0.2 (6533.18.5) and Firefox 4.0b6. What browser do you use?

@frank06
Copy link

frank06 commented Nov 19, 2010

Ah, sorry. Using it in node.js (weird, should behave like Chrome - but i don't know which V8 versions they're running).

@NV
Copy link
Owner Author

NV commented Nov 19, 2010

I see. I'll get reed of __proto__ so it will be fixed soon. It might be a node.js REPL's bug, though.

@frank06
Copy link

frank06 commented Nov 19, 2010

When you fix it, would this output the serialized CSS tree – or just 'don't break'?

By the way, I got the is not generic bug calling the library in a program, not the REPL.

@NV
Copy link
Owner Author

NV commented Nov 19, 2010

CSSStyleSheet.toString has been landed. Try it on demo page.

Node.js bug should be fixed as well. 0eb3d4e. No idea what was causing it.

@frank06
Copy link

frank06 commented Nov 19, 2010

Wow, excellent, thanks! I'll let you know how it goes.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants