Permalink
Browse files

Fixed expanding + signs in calc() when mixed up with adjacent (+) sel…

…ector.
  • Loading branch information...
1 parent 34b37a0 commit 16a6d02acbf0e5bad0d26bb6ec61d874d81bc8ca @GoalSmashers GoalSmashers committed Nov 27, 2011
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/clean.js
  2. +4 −0 test/unit-test.js
View
@@ -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(); });
View
@@ -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({

0 comments on commit 16a6d02

Please sign in to comment.