Legacy maths mode supports old special cases for font property and media queries

This commit is contained in:
Luke Page
2013-02-02 15:49:43 +00:00
parent d395adc55b
commit e21bf1d7a1
4 changed files with 42 additions and 12 deletions

View File

@@ -27,7 +27,19 @@ tree.Media.prototype = {
this.ruleset.debugInfo = this.debugInfo;
media.debugInfo = this.debugInfo;
}
media.features = this.features.eval(env);
var strictMathsBypass = false;
if (env.strictMaths === false) {
strictMathsBypass = true;
env.strictMaths = true;
}
try {
media.features = this.features.eval(env);
}
finally {
if (strictMathsBypass) {
env.strictMaths = false;
}
}
env.mediaPath.push(media);
env.mediaBlocks.push(media);

View File

@@ -20,11 +20,23 @@ tree.Rule.prototype.toCSS = function (env) {
}
};
tree.Rule.prototype.eval = function (context) {
return new(tree.Rule)(this.name,
this.value.eval(context),
tree.Rule.prototype.eval = function (env) {
var strictMathsBypass = false;
if (this.name === "font" && env.strictMaths === false) {
strictMathsBypass = true;
env.strictMaths = true;
}
try {
return new(tree.Rule)(this.name,
this.value.eval(env),
this.important,
this.index, this.inline);
}
finally {
if (strictMathsBypass) {
env.strictMaths = false;
}
}
};
tree.Rule.prototype.makeImportant = function () {