critical fix for browser

This commit is contained in:
cloudhead 2010-06-19 14:03:52 -04:00
parent 8e967fe8a0
commit c53309c682
3 changed files with 3 additions and 5 deletions

3
dist/less-1.0.19.js vendored
View File

@ -1606,11 +1606,10 @@ tree.mixin.Definition = function (name, params, rules) {
if (p.name && !p.value) { return count + 1 }
else { return count }
}, 0);
this.parent = tree.Ruleset.prototype;
};
tree.mixin.Definition.prototype = {
toCSS: function () { return "" },
parent: tree.Ruleset.prototype,
variable: function (name) { return this.parent.variable.call(this, name) },
find: function () { return this.parent.find.apply(this, arguments) },
rulesets: function () { return this.parent.rulesets.apply(this) },

View File

@ -44,7 +44,7 @@ a)},find:function(){return d.Ruleset.prototype.find.apply(this.ruleset,arguments
a;this.path=a instanceof d.Quoted?/\.(le?|c)ss$/.test(a.content)?a.content:a.content+".less":a.value.content||a.value;(this.css=/css$/.test(this.path))||e.push(this.path,function(g){b.root=g})};d.Import.prototype={toCSS:function(){return this.css?"@import "+this._path.toCSS()+";\n":""},eval:function(){if(this.css)return this;else{for(var a=0;a<this.root.rules.length;a++)this.root.rules[a]instanceof d.Import&&Array.prototype.splice.apply(this.root.rules,[a,1].concat(this.root.rules[a].eval()));return this.root.rules}}}})(q("less/tree"));
(function(d){d.Keyword=function(a){this.value=a};d.Keyword.prototype={eval:function(){return this},toCSS:function(){return this.value}}})(q("less/tree"));(function(d){d.mixin={};d.mixin.Call=function(a,e,b){this.selector=new d.Selector(a);this.arguments=e;this.index=b};d.mixin.Call.prototype={eval:function(a){for(var e,b=[],g=false,i=0;i<a.frames.length;i++)if((e=a.frames[i].find(this.selector)).length>0){for(i=0;i<e.length;i++)if(e[i].match(this.arguments,a))try{Array.prototype.push.apply(b,e[i].eval(this.arguments,
a).rules);g=true}catch(j){throw{message:j.message,index:j.index,call:this.index};}if(g)return b;else throw{message:"No matching definition was found for `"+this.selector.toCSS().trim()+"("+this.arguments.map(function(l){return l.toCSS()}).join(", ")+")`",index:this.index};}throw{message:this.selector.toCSS().trim()+" is undefined",index:this.index};}};d.mixin.Definition=function(a,e,b){this.name=a;this.selectors=[new d.Selector([new d.Element(null,a)])];this.params=e;this.arity=e.length;this.rules=
b;this._lookups={};this.required=e.reduce(function(g,i){return i.name&&!i.value?g+1:g},0)};d.mixin.Definition.prototype={toCSS:function(){return""},parent:d.Ruleset.prototype,variable:function(a){return this.parent.variable.call(this,a)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},eval:function(a,e){for(var b=new d.Ruleset(null,[]),g=0,i;g<this.params.length;g++)if(this.params[g].name)if(i=a&&a[g]||this.params[g].value)b.rules.unshift(new d.Rule(this.params[g].name,
b;this._lookups={};this.required=e.reduce(function(g,i){return i.name&&!i.value?g+1:g},0);this.parent=d.Ruleset.prototype};d.mixin.Definition.prototype={toCSS:function(){return""},variable:function(a){return this.parent.variable.call(this,a)},find:function(){return this.parent.find.apply(this,arguments)},rulesets:function(){return this.parent.rulesets.apply(this)},eval:function(a,e){for(var b=new d.Ruleset(null,[]),g=0,i;g<this.params.length;g++)if(this.params[g].name)if(i=a&&a[g]||this.params[g].value)b.rules.unshift(new d.Rule(this.params[g].name,
i.eval(e)));else throw{message:"wrong number of arguments for "+this.name+" ("+a.length+" for "+this.arity+")"};return(new d.Ruleset(null,this.rules)).evalRules({frames:[this,b].concat(e.frames)})},match:function(a,e){var b=a&&a.length||0;if(b<this.required)return false;for(var g=0;g<Math.min(b,this.arity);g++)if(!this.params[g].name)if(!a[g].wildcard)if(a[g].eval(e).toCSS()!=this.params[g].value.eval(e).toCSS())return false;return true}}})(q("less/tree"));(function(d){d.Operation=function(a,e){this.op=
a.trim();this.operands=e};d.Operation.prototype.eval=function(a){var e=this.operands[0].eval(a);a=this.operands[1].eval(a);var b;if(e instanceof d.Dimension&&a instanceof d.Color)if(this.op==="*"||this.op==="+"){b=a;a=e;e=b}else throw{name:"OperationError",message:"Can't substract or divide a color from a number"};return e.operate(this.op,a)};d.operate=function(a,e,b){switch(a){case "+":return e+b;case "-":return e-b;case "*":return e*b;case "/":return e/b}}})(q("less/tree"));(function(d){d.Quoted=
function(a,e){this.value=a;this.content=e};d.Quoted.prototype={toCSS:function(){return this.value},eval:function(){return this}}})(q("less/tree"));(function(d){d.Rule=function(a,e,b){this.name=a;this.value=e instanceof d.Value?e:new d.Value([e]);this.index=b;this.variable=a.charAt(0)==="@"?true:false};d.Rule.prototype.toCSS=function(a){return this.variable?"":this.name+(a.compress?":":": ")+this.value.toCSS(a)+";"};d.Rule.prototype.eval=function(a){return new d.Rule(this.name,this.value.eval(a))};

View File

@ -51,11 +51,10 @@ tree.mixin.Definition = function (name, params, rules) {
if (p.name && !p.value) { return count + 1 }
else { return count }
}, 0);
this.parent = tree.Ruleset.prototype;
};
tree.mixin.Definition.prototype = {
toCSS: function () { return "" },
parent: tree.Ruleset.prototype,
variable: function (name) { return this.parent.variable.call(this, name) },
find: function () { return this.parent.find.apply(this, arguments) },
rulesets: function () { return this.parent.rulesets.apply(this) },