From 9970cb0124aa464cc0e7f8f063754bb0cfa83c22 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Thu, 25 Feb 2010 22:32:13 -0500 Subject: [PATCH] parse IE's alpha() --- lib/less/adapters/server.js | 2 +- lib/less/parser.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/less/adapters/server.js b/lib/less/adapters/server.js index b77de3a..a17dce6 100644 --- a/lib/less/adapters/server.js +++ b/lib/less/adapters/server.js @@ -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))); }); diff --git a/lib/less/parser.js b/lib/less/parser.js index ab12923..0bbd2c1 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -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) {