mirror of
https://github.com/less/less.js.git
synced 2026-02-11 07:25:07 -05:00
change negation operators to be more cssy
This commit is contained in:
@@ -1171,17 +1171,17 @@ less.Parser = function Parser(env) {
|
||||
condition: function () {
|
||||
var a, b, c, op, index = i, negate = false;
|
||||
|
||||
if ($(/^not/)) { negate = true }
|
||||
expect('(');
|
||||
if ($('!')) { negate = true }
|
||||
if (a = $(this.addition) || $(this.entities.keyword) || $(this.entities.quoted)) {
|
||||
if (op = $(/^(?:>=|=<|\!=|[<=>])/)) {
|
||||
if (op = $(/^(?:>=|=<|\^=|[<=>])/)) {
|
||||
if (b = $(this.addition) || $(this.entities.keyword) || $(this.entities.quoted)) {
|
||||
c = new(tree.Condition)(op, a, b, index);
|
||||
} else {
|
||||
error('expected expression');
|
||||
}
|
||||
} else {
|
||||
c = new(tree.Condition)(negate ? '!=' : '=', a, new(tree.Keyword)('true'), index);
|
||||
c = new(tree.Condition)(negate ? '^=' : '=', a, new(tree.Keyword)('true'), index);
|
||||
}
|
||||
expect(')');
|
||||
return $(/^and/) ? new(tree.Condition)('and', c, $(this.condition)) : c;
|
||||
|
||||
@@ -28,9 +28,9 @@ tree.Condition.prototype.eval = function (env) {
|
||||
index: i };
|
||||
}
|
||||
switch (result) {
|
||||
case -1: return this.op === '<' || this.op === '=<' || this.op === '!=';
|
||||
case -1: return this.op === '<' || this.op === '=<' || this.op === '^=';
|
||||
case 0: return this.op === '=' || this.op === '>=' || this.op === '=<';
|
||||
case 1: return this.op === '>' || this.op === '>=' || this.op === '!=';
|
||||
case 1: return this.op === '>' || this.op === '>=' || this.op === '^=';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user