Add alias for =< as <= fixes #1435

This commit is contained in:
Luke Page
2013-09-18 05:42:21 +01:00
parent 62751c917c
commit 39b36d9cfc
4 changed files with 8 additions and 3 deletions

View File

@@ -1629,7 +1629,7 @@ less.Parser = function Parser(env) {
if ($(/^not/)) { negate = true; }
expect('(');
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, negate);
} else {

View File

@@ -36,8 +36,8 @@ tree.Condition.prototype = {
index: i };
}
switch (result) {
case -1: return op === '<' || op === '=<';
case 0: return op === '=' || op === '>=' || op === '=<';
case -1: return op === '<' || op === '=<' || op === '<=';
case 0: return op === '=' || op === '>=' || op === '=<' || op === '<=';
case 1: return op === '>' || op === '>=';
}
}

View File

@@ -18,6 +18,7 @@
.ops1 {
height: gt-or-eq;
height: lt-or-eq;
height: lt-or-eq-alias;
}
.ops2 {
height: gt-or-eq;
@@ -25,6 +26,7 @@
}
.ops3 {
height: lt-or-eq;
height: lt-or-eq-alias;
height: not-eq;
}
.default1 {

View File

@@ -43,6 +43,9 @@
.ops (@a) when (@a =< 0) {
height: lt-or-eq;
}
.ops (@a) when (@a <= 0) {
height: lt-or-eq-alias;
}
.ops (@a) when not(@a = 0) {
height: not-eq;
}