fix alpha(opacity=n) support

This commit is contained in:
Alexis Sellier
2011-05-27 18:20:27 -04:00
parent b043fd4507
commit b68dbcf55f
6 changed files with 14 additions and 2 deletions

View File

@@ -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);

View File

@@ -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'));

View File

@@ -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;

View File

@@ -19,3 +19,6 @@
.variable-names {
name: 'hello';
}
.alpha {
filter: alpha(opacity=42);
}

View File

@@ -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 {

View File

@@ -44,3 +44,7 @@
@name: 'var';
name: @@name;
}
.alpha {
@var: 42;
filter: alpha(opacity=@var);
}