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

Wrong placement of an extra comment closing #965

Closed
BugHunter2k opened this issue Aug 14, 2017 · 3 comments
Closed

Wrong placement of an extra comment closing #965

BugHunter2k opened this issue Aug 14, 2017 · 3 comments
Labels

Comments

@BugHunter2k
Copy link

Environment

  • clean-css version - npm ls clean-css:
    clean-css@4.1.7

  • node.js version - node -v:
    v6.6.0

  • operating system:
    Kubuntu 17.04

Configuration options

defaults

Input CSS

[class*='col-'] {
	float: left;
	padding-right: 30px; /* column-space */
}

[class*='col-']:last-child {
    float: left;
/*     padding-right: 0; /* column-space */ */
}


.grid {
	width: 100%;
	max-width: 1200px;
	min-width: 755px;
	margin: 0 auto;
}

Actual output CSS

[class*=col-]{float:left;padding-right:30px}[class*=col-]:last-child{float:left}*/ .grid{width:100%;max-width:1200px;min-width:755px;margin:0 auto}

Expected output CSS

[class*=col-]{float:left;padding-right:30px}[class*=col-]:last-child{float:left}.grid{width:100%;max-width:1200px;min-width:755px;margin:0 auto}
@jakubpawlowicz
Copy link
Collaborator

Please correct me if I'm wrong but clean-css should not remove the */ piece, consider the following example: https://jsfiddle.net/z4vxqafd/.

The first */ closes both comments and the parsers treat the second */ as a part of next property (in given case background-color rendering it invalid.

It's a separate question why clean-css puts remaining */ outside of a rule not inside.

@BugHunter2k
Copy link
Author

Yes, you are right. The css specs (I haven't checked them before) so my css was faulty.
https://drafts.csswg.org/css-syntax-3/#comment-diagram

But you are right about the placement of the */ that should be inside the rule.

@jakubpawlowicz jakubpawlowicz changed the title Nested comments breaks output-css Wrong placement of an extra comment closing Aug 29, 2017
jakubpawlowicz added a commit that referenced this issue Sep 2, 2017
This is an edge case when a comment is closed twice leading to the
second end marker leaking to the next token.
jakubpawlowicz added a commit that referenced this issue Sep 2, 2017
This is an edge case when a comment is closed twice leading to the
second end marker leaking to the next token.
@jakubpawlowicz
Copy link
Collaborator

It's fixed in 4.1.8, thanks!

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

No branches or pull requests

2 participants