parse IE's alpha()

This commit is contained in:
cloudhead 2010-02-25 22:32:13 -05:00
parent 2353885d6a
commit 9970cb0124
2 changed files with 12 additions and 1 deletions

View File

@ -9,7 +9,7 @@ process.mixin(less, require('less/parser'));
['color', 'directive', 'operation', 'dimension',
'keyword', 'variable', 'ruleset', 'element',
'selector', 'quoted', 'expression', 'rule',
'call', 'url'
'call', 'url', 'alpha'
].forEach(function (n) {
process.mixin(less.parser, require(path.join('less', 'node', n)));
});

View File

@ -295,6 +295,15 @@ less.parser = {
}
}
},
alpha: function alpha() {
var value;
if (! $(/alpha\(opacity=/g)) return;
if (value = $(/[0-9]+/g) || $(this.entities.variable)) {
if (! $(')')) throw new(Error)("missing closing ) for alpha()");
return new(node.Alpha)(value);
}
},
combinator: function combinator() {
var match;
if (match = $(/[+>~]/g) || $('&') || $(/::/g)) {
@ -404,6 +413,8 @@ less.parser = {
expressions.push(e);
if (! $(',')) { break }
}
if (expressions.length === 0 && (e = $(this.alpha))) { expressions.push(e) }
important = $(/!\s*important/g);
if (expressions.length > 0) {