Permalink
Browse files

Fixes #834 Percentage calculation not used when value is expression

  • Loading branch information...
1 parent b4c438d commit dd3c3f70ba162d08e98372f6e864df4c0144f623 @tonistiigi committed Oct 23, 2012
Showing with 16 additions and 1 deletion.
  1. +2 −1 lib/nodes/unit.js
  2. +6 −0 test/cases/regression.834.css
  3. +8 −0 test/cases/regression.834.styl
View
@@ -92,11 +92,12 @@ Unit.prototype.operate = function(op, right){
// operate
if (this.shouldCoerce(op)) {
+ right = right.first;
// percentages
if (('-' == op || '+' == op) && '%' == right.type) {
right.val = this.val * (right.val / 100);
} else {
- right = this.coerce(right.first);
+ right = this.coerce(right);
}
switch (op) {
@@ -0,0 +1,6 @@
+.grid {
+ width: 45%;
+}
+.grid {
+ width: 45%;
+}
@@ -0,0 +1,8 @@
+grid(x)
+ width: 50% - x
+
+.grid
+ grid(10%)
+
+.grid
+ grid 10%

0 comments on commit dd3c3f7

Please sign in to comment.