Skip to content

Commit

Permalink
Fixed expanding + signs in calc() when mixed up with adjacent (+) sel…
Browse files Browse the repository at this point in the history
…ector.
  • Loading branch information
Jakub Pawlowicz committed Nov 27, 2011
1 parent 34b37a0 commit 16a6d02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/clean.js
Expand Up @@ -115,7 +115,7 @@ var CleanCSS = {
replace(/\} /g, '}') // whitespace after definition

// Get the special comments, content content, and spaces inside calc back
replace(/calc\((.+)\)([;\}\w])/, function(match) {
replace(/calc\([^\}]+\}/g, function(match) {
return match.replace(/\+/g, ' + ');
});
replace(/__CSSCOMMENT__/g, function() { return specialComments.shift(); });
Expand Down
4 changes: 4 additions & 0 deletions test/unit-test.js
Expand Up @@ -131,6 +131,10 @@ vows.describe('clean-units').addBatch({
'not strip standalone universal selector': [
'label ~ * + span',
'label~*+span'
],
'not expand + in selectors mixed with calc methods': [
'div{width:calc(50% + 3em)}div + div{width:100%}div:hover{width:calc(50% + 4em)}* > div {border:1px solid #f0f}',
'div{width:calc(50% + 3em)}div+div{width:100%}div:hover{width:calc(50% + 4em)}*>div{border:1px solid #f0f}'
]
}),
'comments': cssContext({
Expand Down

0 comments on commit 16a6d02

Please sign in to comment.