Fix one issue with media queries and detached rulesets, one to go

This commit is contained in:
Luke Page
2014-02-16 17:50:51 +00:00
parent b46ca11286
commit c730829d1d
4 changed files with 59 additions and 4 deletions

View File

@@ -147,6 +147,8 @@ tree.Media.prototype = {
}
},
bubbleSelectors: function (selectors) {
if (!selectors)
return;
this.rules = [new(tree.Ruleset)(selectors.slice(0), [this.rules[0]])];
}
};

View File

@@ -2,7 +2,7 @@
tree.Rule = function (name, value, important, merge, index, currentFileInfo, inline) {
this.name = name;
this.value = (value instanceof tree.Value) ? value : new(tree.Value)([value]);
this.value = (value instanceof tree.Value || value instanceof tree.Ruleset) ? value : new(tree.Value)([value]);
this.important = important ? ' ' + important.trim() : '';
this.merge = merge;
this.index = index;
@@ -46,7 +46,6 @@ tree.Rule.prototype = {
evaldValue = this.value.eval(env);
if (!this.variable && evaldValue.type === "Ruleset") {
console.log(this.index);
throw { message: "Rulesets cannot be evaluated on a property.",
index: this.index, filename: this.currentFileInfo.filename };
}