(no title)
systoll | 2 months ago
HTML comments are basically just a HTML tag that isn't rendered. Tools that 'compile' the HTML code into a document tree, including browsers, preserve comments as nodes without any extra effort.
CSS comments can go anywhere:
/*wow*/ .selector /*x*/ {animation /*z*/: 2s /*z*/ linear /*z*/ bounce;}
Tools that transform/parse CSS can either:
1. Strip comments before parsing, meaning anything based on the parsed version will lose the comments.
2. Dedicate a disproportionate amount of complexity to retaining the comments, and still not really have a good way to handle them through edits/transformations.
yread|2 months ago
EDIT: also why is it useful to have comments in the object model in the first place? To access them from js?
nialse|2 months ago
A similar issue is CDATA in XML which is not retained when round-tripped. Very annoying, but in line with the spec.