logoalt Hacker News

yreadlast Thursday at 10:22 AM1 replyview on HN

But if it's valid CSS it has to be representable in AST/object model? It's a comment, it can't have any child nodes, it doesn't depend on anything - pretty trivial. And if it's in the tree you can transform it with proper tools. If you are transforming CSS you have to write a proper parser and not just a bunch of regexes

EDIT: also why is it useful to have comments in the object model in the first place? To access them from js?


Replies

nialselast Thursday at 11:45 AM

Round-tripping to CSS and keeping information that may be useful to the user if they would inspect the content I would presume.

A similar issue is CDATA in XML which is not retained when round-tripped. Very annoying, but in line with the spec.