fixed a bug when using @media with mixins

This commit is contained in:
Marcel Jackwerth
2012-02-17 11:57:31 +01:00
parent 081c26dc9a
commit 1ba622dd8d
3 changed files with 60 additions and 13 deletions

View File

@@ -22,22 +22,23 @@ tree.Media.prototype = {
env.mediaBlocks = [];
env.mediaPath = [];
}
env.mediaBlocks.push(this);
var blockIndex = env.mediaBlocks.length;
env.mediaPath.push(this);
env.mediaBlocks.push(this);
this.features = this.features.eval(env);
env.frames.unshift(this);
this.ruleset = this.ruleset.eval(env);
var media = new(tree.Media)([], []);
media.features = this.features.eval(env);
env.frames.unshift(this.ruleset);
media.ruleset = this.ruleset.eval(env);
env.frames.shift();
env.mediaBlocks[blockIndex] = media;
env.mediaPath.pop();
if (env.mediaPath.length === 0) {
return this.evalTop(env);
} else {
return this.evalNested(env);
}
return env.mediaPath.length === 0 ? media.evalTop(env) :
media.evalNested(env)
},
variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) },
find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) },
@@ -93,9 +94,9 @@ tree.Media.prototype = {
return new(tree.Ruleset)([], []);
},
permute: function (arr) {
if (arr.length == 0) {
if (arr.length === 0) {
return [];
} else if (arr.length == 1) {
} else if (arr.length === 1) {
return arr[0];
} else {
var result = [];