tdewolff / parse

Go parsers for web formats
MIT License
411 stars 64 forks source link

CSS parser ignoring comments within rulesets #107

Open lucasgrinspan opened 1 year ago

lucasgrinspan commented 1 year ago

Hello there, I've noticed some interesting behavior with the CSS parser. It doesn't seem to return comment grammar for comments in rulesets. It works fine for comments defined outside of rulesets however. As an example:

/* test */ 
h1 {
    color: red; 
    /* test */ 
}

Iterating over the above stylesheet leads to only one Comment instead of the expected two. Is this a bug in the parser? Reproduction Link

tdewolff commented 1 year ago

Yes, only the first comment is preserved for now, and a big change to the CSS parser is pending to allow for all the new syntax added in recent versions. I can come back to this in March after vacation

El jue., 2 de feb. de 2023 16:40, Lucas Grinspan @.***> escribió:

Hello there, I've noticed some interesting behavior with the CSS parser. It doesn't seem to return comment grammar for comments in rulesets. It works fine for comments defined outside of rulesets however. As an example:

/ test / h1 { color: red; / test / }

Iterating over the above stylesheet leads to only one Comment instead of the expected two. Is this a bug in the parser? Reproduction Link https://go.dev/play/p/Y9f9fiTUkD8

— Reply to this email directly, view it on GitHub https://github.com/tdewolff/parse/issues/107, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKOGHSEQEF7LXWTX2OR47TWVQSWTANCNFSM6AAAAAAUPRJB5Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>