diff --git a/lib/less/tree/quoted.js b/lib/less/tree/quoted.js index 131bfad9..b8f63b9c 100644 --- a/lib/less/tree/quoted.js +++ b/lib/less/tree/quoted.js @@ -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; } }; diff --git a/test/css/mixins-guards.css b/test/css/mixins-guards.css index 25e6f287..27fa9762 100644 --- a/test/css/mixins-guards.css +++ b/test/css/mixins-guards.css @@ -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; diff --git a/test/less/mixins-guards.less b/test/less/mixins-guards.less index 6a02067b..62dc39df 100644 --- a/test/less/mixins-guards.less +++ b/test/less/mixins-guards.less @@ -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); }