Skip to content

Commit

Permalink
Fixed that in some situations a mixin call into a referenced file wou…
Browse files Browse the repository at this point in the history
…ldn't import media queries. Fixes #1469
  • Loading branch information
lukeapage committed Feb 21, 2014
1 parent 6d5473e commit bf9c590
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
1 change: 1 addition & 0 deletions lib/less/tree/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ tree.Media.prototype = {
},
markReferenced: function () {
var i, rules = this.rules[0].rules;
this.rules[0].markReferenced();
this.isReferenced = true;
for (i = 0; i < rules.length; i++) {
if (rules[i].markReferenced) {
Expand Down
27 changes: 23 additions & 4 deletions test/css/import-reference.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
The media statement above is invalid (no selector)
We should ban invalid media queries with properties and no selector?
*/
input[type="text"].class#id[attr=32]:not(1) {
color: white;
}
div#id.class[a=1][b=2].class:not(1) {
color: white;
}
@media print {
.class {
color: blue;
}
.class .sub {
width: 42;
}
}
.visible {
color: red;
}
Expand Down Expand Up @@ -47,3 +57,12 @@
.visible {
extend: test;
}
.test-mediaq-import {
color: green;
test: 340px;
}
@media (max-size: 450px) {
.test-mediaq-import {
color: red;
}
}
11 changes: 7 additions & 4 deletions test/less/import-reference.less
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
@import (reference) url("import-once.less");
@import (reference) url("css-3.less");
@import (reference) url("media.less");
/*
The media statement above is invalid (no selector)
We should ban invalid media queries with properties and no selector?
*/
@import (reference) url("import/import-reference.less");

.b {
Expand All @@ -15,4 +11,11 @@

.visible:extend(.z all) {
extend: test;
}

.test-mediaq-import {
.mixin-with-mediaq(340px);
}

.class:extend(.class all) {
}
8 changes: 8 additions & 0 deletions test/less/import/import-reference.less
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@
pulled-in: yes;
}
/* comment pulled in */
}
@max-size: 450px;
.mixin-with-mediaq(@num) {
color: green;
test: @num;
@media (max-size: @max-size) {
color: red;
}
}

0 comments on commit bf9c590

Please sign in to comment.