mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
fix, less with compression (-x) was unable to parse auto\9
This commit is contained in:
@@ -1197,19 +1197,19 @@ less.Parser = function Parser(env) {
|
||||
restore();
|
||||
}
|
||||
},
|
||||
rule: function () {
|
||||
rule: function (tryAnonymous) {
|
||||
var name, value, c = input.charAt(i), important, match;
|
||||
save();
|
||||
|
||||
if (c === '.' || c === '#' || c === '&') { return }
|
||||
|
||||
if (name = $(this.variable) || $(this.property)) {
|
||||
if (!env.compress && (name.charAt(0) != '@') && (match = /^([^@+\/'"*`(;{}-]*);/.exec(chunks[j]))) {
|
||||
i += match[0].length - 1;
|
||||
value = new(tree.Anonymous)(match[1]);
|
||||
} else {
|
||||
value = $(this.value);
|
||||
}
|
||||
// prefer to try to parse first if its a variable or we are compressing
|
||||
// but always fallback on the other one
|
||||
value = !tryAnonymous && (env.compress || (name.charAt(0) === '@')) ?
|
||||
($(this.value) || $(this.anonymousValue)) :
|
||||
($(this.anonymousValue) || $(this.value));
|
||||
|
||||
important = $(this.important);
|
||||
|
||||
if (value && $(this.end)) {
|
||||
@@ -1217,9 +1217,18 @@ less.Parser = function Parser(env) {
|
||||
} else {
|
||||
furthest = i;
|
||||
restore();
|
||||
if (value && !tryAnonymous) {
|
||||
return this.rule(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
anonymousValue: function () {
|
||||
if (match = /^([^@+\/'"*`(;{}-]*);/.exec(chunks[j])) {
|
||||
i += match[0].length - 1;
|
||||
return new(tree.Anonymous)(match[1]);
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// An @import directive
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#colours{color1:#fea;color2:#fea;color3:rgba(255,238,170,0.1);string:"#ffeeaa"}
|
||||
dimensions{val:.1px;val:0;val:4cm;val:.2;val:5;angles-must-have-unit:0deg}
|
||||
dimensions{val:.1px;val:0;val:4cm;val:.2;val:5;angles-must-have-unit:0deg;width:auto\9}
|
||||
|
||||
@@ -74,6 +74,7 @@ p + h1 {
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), to(#0000ff));
|
||||
margin: ;
|
||||
filter: alpha(opacity=100);
|
||||
width: auto\9;
|
||||
}
|
||||
.misc .nested-multiple {
|
||||
multiple-semi-colons: yes;
|
||||
|
||||
@@ -12,4 +12,5 @@ dimensions {
|
||||
val: 0.2;
|
||||
val: 5;
|
||||
angles-must-have-unit: 0deg;
|
||||
width: auto\9;
|
||||
}
|
||||
@@ -85,6 +85,7 @@ p + h1 {
|
||||
multiple-semi-colons: yes;;;;;;
|
||||
};
|
||||
filter: alpha(opacity=100);
|
||||
width: auto\9;
|
||||
}
|
||||
|
||||
#important {
|
||||
|
||||
Reference in New Issue
Block a user