[Pkg-javascript-commits] [less.js] 39/88: more tests and name arguments for caller
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:22:24 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v1.7.0
in repository less.js.
commit 55033c77ed7942d5223b07b90e5df119fc5ea3dd
Author: Luke Page <luke.a.page at gmail.com>
Date: Tue Feb 11 22:01:26 2014 +0000
more tests and name arguments for caller
---
lib/less/parser.js | 18 ++++++++++++++++--
test/css/detached-rulesets.css | 14 ++++++++++++++
test/less/detached-rulesets.less | 19 ++++++++++++++++++-
3 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/lib/less/parser.js b/lib/less/parser.js
index 4fa31f5..76f312e 100644
--- a/lib/less/parser.js
+++ b/lib/less/parser.js
@@ -1182,7 +1182,17 @@ less.Parser = function Parser(env) {
}
expressionContainsNamed = true;
}
- value = expect(parsers.expression);
+ // we do not support setting a ruleset as a default variable - it doesn't make sense
+ // and to implement it we need backtracking with multiple saves
+ value = (isCall && parsers.blockRuleset()) || parsers.expression();
+ if (!value) {
+ if (isCall) {
+ error("could not understand value for named argument");
+ } else {
+ returner.args = [];
+ return returner;
+ }
+ }
nameLoop = (name = val.name);
} else if (!isCall && $re(/^\.{3}/)) {
returner.variadic = true;
@@ -1267,10 +1277,14 @@ less.Parser = function Parser(env) {
variadic = argInfo.variadic;
// .mixincall("@{a}");
- // looks a bit like a mixin definition.. so we have to be nice and restore
+ // looks a bit like a mixin definition..
+ // also
+ // .mixincall(@a: {rule: set;});
+ // so we have to be nice and restore
if (!$char(')')) {
furthest = i;
restore();
+ return;
}
parsers.comments();
diff --git a/test/css/detached-rulesets.css b/test/css/detached-rulesets.css
index 08e82bc..dc706a6 100644
--- a/test/css/detached-rulesets.css
+++ b/test/css/detached-rulesets.css
@@ -2,6 +2,20 @@
color: black;
}
.wrap-selector {
+ color: red;
+}
+.wrap-selector {
color: black;
background: white;
}
+header {
+ background: blue;
+}
+ at media screen and (min-width: 1200) {
+ header {
+ background: red;
+ }
+}
+html.lt-ie9 header {
+ background: red;
+}
diff --git a/test/less/detached-rulesets.less b/test/less/detached-rulesets.less
index 4936076..01abdd7 100644
--- a/test/less/detached-rulesets.less
+++ b/test/less/detached-rulesets.less
@@ -13,4 +13,21 @@
color: black;
});
-.wrap-mixin(@ruleset);
\ No newline at end of file
+.wrap-mixin(@ruleset: {
+ color: red;
+});
+
+.wrap-mixin(@ruleset);
+
+.desktop-and-old-ie(@rules) {
+ @media screen and (min-width: 1200) { @rules(); }
+ html.lt-ie9 & { @rules(); }
+}
+
+header {
+ background: blue;
+
+ .desktop-and-old-ie({
+ background: red;
+ });
+}
--
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