mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
fix alpha(opacity=n) support
This commit is contained in:
@@ -764,7 +764,7 @@ less.Parser = function Parser(env) {
|
||||
alpha: function () {
|
||||
var value;
|
||||
|
||||
if (! $(/^opacity=/i)) return;
|
||||
if (! $(/^\(opacity=/i)) return;
|
||||
if (value = $(/^\d+/) || $(this.entities.variable)) {
|
||||
if (! $(')')) throw new(Error)("missing closing ) for alpha()");
|
||||
return new(tree.Alpha)(value);
|
||||
|
||||
@@ -8,7 +8,10 @@ tree.Alpha.prototype = {
|
||||
return "alpha(opacity=" +
|
||||
(this.value.toCSS ? this.value.toCSS() : this.value) + ")";
|
||||
},
|
||||
eval: function () { return this }
|
||||
eval: function (env) {
|
||||
if (this.value.eval) { this.value = this.value.eval(env) }
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
})(require('less/tree'));
|
||||
|
||||
@@ -66,6 +66,7 @@ p + h1 {
|
||||
background-image: url(images/image.jpg);
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(red), to(blue));
|
||||
margin: ;
|
||||
filter: alpha(opacity=100);
|
||||
}
|
||||
#important {
|
||||
color: red !important;
|
||||
|
||||
@@ -19,3 +19,6 @@
|
||||
.variable-names {
|
||||
name: 'hello';
|
||||
}
|
||||
.alpha {
|
||||
filter: alpha(opacity=42);
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ p + h1 {
|
||||
background-image: url(images/image.jpg);
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(red), to(blue));
|
||||
margin: ;
|
||||
filter: alpha(opacity=100);
|
||||
}
|
||||
|
||||
#important {
|
||||
|
||||
@@ -44,3 +44,7 @@
|
||||
@name: 'var';
|
||||
name: @@name;
|
||||
}
|
||||
.alpha {
|
||||
@var: 42;
|
||||
filter: alpha(opacity=@var);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user