[Pkg-javascript-commits] [less.js] 38/58: Important on parametrized mixin #2394

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:28:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.3.0
in repository less.js.

commit d0e217e7436060969e51060b03479eb93b5dff8f
Author: jurcovicovam <meri at meri.org>
Date:   Wed Jan 21 14:54:48 2015 +0100

    Important on parametrized mixin #2394
    
    The !important flag on mixin call prevented proper evaluation of variables inside nested mixins. #2394
---
 lib/less/tree/ruleset.js        | 18 +++++++++---------
 test/css/mixins-important.css   |  6 ++++++
 test/less/mixins-important.less | 12 ++++++++++++
 3 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js
index aa86214..934fce0 100644
--- a/lib/less/tree/ruleset.js
+++ b/lib/less/tree/ruleset.js
@@ -182,15 +182,15 @@ Ruleset.prototype.evalImports = function(context) {
     }
 };
 Ruleset.prototype.makeImportant = function() {
-    return new Ruleset(this.selectors, this.rules.map(function (r) {
-                if (r.makeImportant) {
-                    return r.makeImportant();
-                } else {
-                    return r;
-                }
-            }), this.strictImports);
-};
-Ruleset.prototype.matchArgs = function (args) {
+    this.rules = this.rules.map(function (r) {
+        if (r.makeImportant) {
+            return r.makeImportant();
+        } else {
+            return r;
+        }
+    });
+    return this;
+};Ruleset.prototype.matchArgs = function (args) {
     return !args || args.length === 0;
 };
 // lets you call a css selector with a guard
diff --git a/test/css/mixins-important.css b/test/css/mixins-important.css
index b100af7..1b9faa1 100644
--- a/test/css/mixins-important.css
+++ b/test/css/mixins-important.css
@@ -43,3 +43,9 @@
 .class .inner {
   test: 9;
 }
+.when-calling-nested-issue-2394 {
+  width: auto !important;
+}
+.when-calling-nested-with-param-issue-2394 {
+  width: 10px !important;
+}
diff --git a/test/less/mixins-important.less b/test/less/mixins-important.less
index 5014e81..0a1ff18 100644
--- a/test/less/mixins-important.less
+++ b/test/less/mixins-important.less
@@ -23,3 +23,15 @@
   .mixin !important;
   .mixin(9);
 }
+.size(@aaa: auto) {
+  .set-width(@aaa) {
+    width: @aaa;
+  }
+  .set-width(@aaa);
+}
+.when-calling-nested-issue-2394 {
+  .size() !important;
+}
+.when-calling-nested-with-param-issue-2394 {
+  .size(10px) !important;
+}
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list