[Pkg-javascript-commits] [less.js] 49/88: Fix one issue with media queries and detached rulesets, one to go
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:22:25 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 c730829d1d609f250b522775fa1745537f6b77a4
Author: Luke Page <luke.a.page at gmail.com>
Date: Sun Feb 16 17:50:51 2014 +0000
Fix one issue with media queries and detached rulesets, one to go
---
lib/less/tree/media.js | 2 ++
lib/less/tree/rule.js | 3 +--
test/css/detached-rulesets.css | 17 +++++++++++++++++
test/less/detached-rulesets.less | 41 ++++++++++++++++++++++++++++++++++++++--
4 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/lib/less/tree/media.js b/lib/less/tree/media.js
index c3b8510..4531cf4 100644
--- a/lib/less/tree/media.js
+++ b/lib/less/tree/media.js
@@ -147,6 +147,8 @@ tree.Media.prototype = {
}
},
bubbleSelectors: function (selectors) {
+ if (!selectors)
+ return;
this.rules = [new(tree.Ruleset)(selectors.slice(0), [this.rules[0]])];
}
};
diff --git a/lib/less/tree/rule.js b/lib/less/tree/rule.js
index ac90049..5567b07 100644
--- a/lib/less/tree/rule.js
+++ b/lib/less/tree/rule.js
@@ -2,7 +2,7 @@
tree.Rule = function (name, value, important, merge, index, currentFileInfo, inline) {
this.name = name;
- this.value = (value instanceof tree.Value) ? value : new(tree.Value)([value]);
+ this.value = (value instanceof tree.Value || value instanceof tree.Ruleset) ? value : new(tree.Value)([value]);
this.important = important ? ' ' + important.trim() : '';
this.merge = merge;
this.index = index;
@@ -46,7 +46,6 @@ tree.Rule.prototype = {
evaldValue = this.value.eval(env);
if (!this.variable && evaldValue.type === "Ruleset") {
- console.log(this.index);
throw { message: "Rulesets cannot be evaluated on a property.",
index: this.index, filename: this.currentFileInfo.filename };
}
diff --git a/test/css/detached-rulesets.css b/test/css/detached-rulesets.css
index d723a0c..b9642d4 100644
--- a/test/css/detached-rulesets.css
+++ b/test/css/detached-rulesets.css
@@ -45,3 +45,20 @@ html.lt-ie9 header {
.without-mixins {
b: 1;
}
+ at media (orientation: portrait) {
+ /* .wrap-media-mixin({
+ @media tv {
+ .triple-wrapped-mq {
+ triple: true;
+ }
+ }
+ });*/
+}
+ at media (orientation: portrait) and tv {
+ .my-selector {
+ background-color: black;
+ }
+}
+.a {
+ test: test;
+}
diff --git a/test/less/detached-rulesets.less b/test/less/detached-rulesets.less
index 787cc19..5af2a74 100644
--- a/test/less/detached-rulesets.less
+++ b/test/less/detached-rulesets.less
@@ -10,8 +10,8 @@
.wrap-selector {
@c: visible;
@ruleset();
- visible-one: @b;
- visible-two: @c;
+ visible-one: @b;
+ visible-two: @c;
}
};
@@ -63,3 +63,40 @@ header {
.without-mixins {
@ruleset-2();
}
+ at my-ruleset: {
+ .my-selector {
+ @media tv {
+ background-color: black;
+ }
+ }
+ };
+ at media (orientation:portrait) {
+ @my-ruleset();
+ // doesn't work yet
+/* .wrap-media-mixin({
+ @media tv {
+ .triple-wrapped-mq {
+ triple: true;
+ }
+ }
+ });*/
+}
+.wrap-media-mixin(@ruleset) {
+ @media widescreen {
+ @media print {
+ @ruleset();
+ }
+ @ruleset();
+ }
+ @ruleset();
+}
+// unlocking mixins
+ at my-mixins: {
+ .mixin() {
+ test: test;
+ }
+};
+ at my-mixins();
+.a {
+ .mixin();
+}
\ 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