mirror of
https://github.com/less/less.js.git
synced 2026-01-22 21:58:14 -05:00
Merge branch '2_0_0' of https://github.com/less/less.js into 2_0_0
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var Node = require("./node.js"),
|
||||
Paren = require("./paren.js"),
|
||||
Combinator = require("./combinator.js");
|
||||
|
||||
var Element = function (combinator, value, index, currentFileInfo) {
|
||||
@@ -34,11 +35,19 @@ Element.prototype.genCSS = function (env, output) {
|
||||
output.add(this.toCSS(env), this.currentFileInfo, this.index);
|
||||
};
|
||||
Element.prototype.toCSS = function (env) {
|
||||
var value = (this.value.toCSS ? this.value.toCSS(env) : this.value);
|
||||
env = env || {};
|
||||
var value = this.value, firstSelector = env.firstSelector;
|
||||
if (value instanceof Paren) {
|
||||
// selector in parens should not be affected by outer selector
|
||||
// flags (breaks only interpolated selectors - see #1973)
|
||||
env.firstSelector = true;
|
||||
}
|
||||
value = value.toCSS ? value.toCSS(env) : value;
|
||||
env.firstSelector = firstSelector;
|
||||
if (value === '' && this.combinator.value.charAt(0) === '&') {
|
||||
return '';
|
||||
} else {
|
||||
return this.combinator.toCSS(env || {}) + value;
|
||||
return this.combinator.toCSS(env) + value;
|
||||
}
|
||||
};
|
||||
module.exports = Element;
|
||||
|
||||
@@ -125,6 +125,9 @@ p a span {
|
||||
:nth-child(3) {
|
||||
selector: interpolated;
|
||||
}
|
||||
.test:nth-child(3) {
|
||||
selector: interpolated;
|
||||
}
|
||||
.test:nth-child(odd):not(:nth-child(3)) {
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
@@ -126,6 +126,9 @@ a {
|
||||
selector: interpolated;
|
||||
}
|
||||
.test {
|
||||
&:nth-child(@{num}) {
|
||||
selector: interpolated;
|
||||
}
|
||||
&:nth-child(odd):not(:nth-child(3)) {
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user