mirror of
https://github.com/less/less.js.git
synced 2026-01-27 08:08:00 -05:00
additional support for mixin guards
This commit is contained in:
@@ -1139,10 +1139,10 @@ less.Parser = function Parser(env) {
|
||||
}
|
||||
},
|
||||
condition: function () {
|
||||
var a, op, index = i;
|
||||
if (a = $(this.addition)) {
|
||||
var a, b, op, index = i;
|
||||
if (a = $(this.addition) || $(this.entities.keyword) || $(this.entities.quoted)) {
|
||||
if (op = $(/^[<=>]/)) {
|
||||
if (b = $(this.addition)) {
|
||||
if (b = $(this.addition) || $(this.entities.keyword) || $(this.entities.quoted)) {
|
||||
return new(tree.Condition)(op, a, b, index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
tree.Keyword = function (value) { this.value = value };
|
||||
tree.Keyword.prototype = {
|
||||
eval: function () { return this },
|
||||
toCSS: function () { return this.value }
|
||||
toCSS: function () { return this.value },
|
||||
compare: function (other) {
|
||||
if (other instanceof tree.Keyword) {
|
||||
return other.value === this.value ? 0 : 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})(require('../tree'));
|
||||
|
||||
@@ -98,7 +98,7 @@ tree.mixin.Definition.prototype = {
|
||||
if (argsLength < this.required) { return false }
|
||||
if ((this.required > 0) && (argsLength > this.params.length)) { return false }
|
||||
if (this.condition && !this.condition.eval({
|
||||
frames: [this.evalParams(env, args)]
|
||||
frames: [this.evalParams(env, args)].concat(env.frames)
|
||||
})) { return false }
|
||||
|
||||
len = Math.min(argsLength, this.arity);
|
||||
|
||||
Reference in New Issue
Block a user