mirror of
https://github.com/less/less.js.git
synced 2026-01-22 21:58:14 -05:00
Changed parser to avoid all alpha() calls being parsed as IE style functions and added relevant tests. Fixes #669
Conflicts: test/css/colors.css test/less/colors.less
This commit is contained in:
@@ -563,7 +563,7 @@ less.Parser = function Parser(env) {
|
||||
// The arguments are parsed with the `entities.arguments` parser.
|
||||
//
|
||||
call: function () {
|
||||
var name, args, index = i;
|
||||
var name, args, alpha_ret, index = i;
|
||||
|
||||
if (! (name = /^([\w-]+|%|progid:[\w\.]+)\(/.exec(chunks[j]))) return;
|
||||
|
||||
@@ -572,7 +572,12 @@ less.Parser = function Parser(env) {
|
||||
if (name === 'url') { return null }
|
||||
else { i += name.length }
|
||||
|
||||
if (name === 'alpha') { return $(this.alpha) }
|
||||
if (name === 'alpha') {
|
||||
alpha_ret = $(this.alpha);
|
||||
if(typeof alpha_ret !== 'undefined') {
|
||||
return alpha_ret;
|
||||
}
|
||||
}
|
||||
|
||||
$('('); // Parse the '(' and consume whitespace.
|
||||
|
||||
|
||||
@@ -60,3 +60,18 @@
|
||||
color: transparent;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
#alpha #fromvar {
|
||||
opacity: 0.7;
|
||||
}
|
||||
#alpha #short {
|
||||
opacity: 1;
|
||||
}
|
||||
#alpha #long {
|
||||
opacity: 1;
|
||||
}
|
||||
#alpha #rgba {
|
||||
opacity: 0.2;
|
||||
}
|
||||
#alpha #hsl {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@@ -66,5 +66,23 @@
|
||||
|
||||
.transparent {
|
||||
color: transparent;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
#alpha {
|
||||
@colorvar: rgba(150, 200, 150, 0.7);
|
||||
#fromvar {
|
||||
opacity: alpha(@colorvar);
|
||||
}
|
||||
#short {
|
||||
opacity: alpha(#aaa);
|
||||
}
|
||||
#long {
|
||||
opacity: alpha(#bababa);
|
||||
}
|
||||
#rgba {
|
||||
opacity: alpha(rgba(50, 120, 95, 0.2));
|
||||
}
|
||||
#hsl {
|
||||
opacity: alpha(hsl(120, 100%, 50%));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user