mirror of
https://github.com/less/less.js.git
synced 2026-01-23 22:27:57 -05:00
Ignore quote type when comparing values. Fixes #1992
This commit is contained in:
@@ -33,14 +33,22 @@ tree.Quoted.prototype = {
|
||||
if (!x.toCSS) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var left = this.toCSS(),
|
||||
|
||||
var left, right;
|
||||
|
||||
// when comparing quoted strings allow the quote to differ
|
||||
if (x.type === "Quoted" && !this.escaped && !x.escaped) {
|
||||
left = x.value;
|
||||
right = this.value;
|
||||
} else {
|
||||
left = this.toCSS();
|
||||
right = x.toCSS();
|
||||
|
||||
}
|
||||
|
||||
if (left === right) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return left < right ? -1 : 1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -67,9 +67,17 @@
|
||||
content: is not #0000ff its #800080;
|
||||
}
|
||||
.stringguardtest {
|
||||
content: is theme1;
|
||||
content: is not theme2;
|
||||
content: is theme1 no quotes;
|
||||
content: "theme1" is "theme1";
|
||||
content: "theme1" is not "theme2";
|
||||
content: "theme1" is 'theme1';
|
||||
content: "theme1" is not 'theme2';
|
||||
content: 'theme1' is "theme1";
|
||||
content: 'theme1' is not "theme2";
|
||||
content: 'theme1' is 'theme1';
|
||||
content: 'theme1' is not 'theme2';
|
||||
content: theme1 is not "theme2";
|
||||
content: theme1 is not 'theme2';
|
||||
content: theme1 is theme1;
|
||||
}
|
||||
#tryNumberPx {
|
||||
catch: all;
|
||||
|
||||
@@ -116,13 +116,17 @@
|
||||
.colorguard(purple);
|
||||
}
|
||||
|
||||
.stringguard(@str) when (@str = "theme1") { content: is theme1; }
|
||||
.stringguard(@str) when not ("theme2" = @str) { content: is not theme2; }
|
||||
.stringguard(@str) when (~"theme1" = @str) { content: is theme1 no quotes; }
|
||||
.stringguard(@str) when (@str = "theme1") { content: @str is "theme1"; }
|
||||
.stringguard(@str) when not ("theme2" = @str) { content: @str is not "theme2"; }
|
||||
.stringguard(@str) when (@str = 'theme1') { content: @str is 'theme1'; }
|
||||
.stringguard(@str) when not ('theme2' = @str) { content: @str is not 'theme2'; }
|
||||
.stringguard(@str) when (~"theme1" = @str) { content: @str is theme1; }
|
||||
.stringguard(@str) {}
|
||||
.stringguardtest {
|
||||
.stringguard("theme1");
|
||||
.stringguard("theme2");
|
||||
.stringguard('theme1');
|
||||
.stringguard('theme2');
|
||||
.stringguard(theme1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user