fix body font size regression

This commit is contained in:
Sindre Sorhus 2014-09-01 00:41:10 +02:00
parent cbefe8761f
commit 9bee1ac647
2 changed files with 10 additions and 4 deletions

View File

@ -88,7 +88,6 @@
box-sizing: border-box; box-sizing: border-box;
} }
.markdown-body,
.markdown-body input { .markdown-body input {
font: 13px Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"; font: 13px Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
line-height: 1.4; line-height: 1.4;

View File

@ -57,13 +57,19 @@ function cleanupCss(str) {
return false; return false;
} }
// remove `body` from `body, input {}`
if (el.selectors[0] === 'body' && el.selectors[1] === 'input') {
el.selectors.shift();
}
if (el.selectors.length === 1 && /^(?:html|body)$/.test(el.selectors[0])) { if (el.selectors.length === 1 && /^(?:html|body)$/.test(el.selectors[0])) {
el.declarations = el.declarations.filter(function (declaration) { el.declarations = el.declarations.filter(function (declaration) {
if (!/^font|^(?:line-height|color)$|text-size-adjust$/.test(declaration.property)) { // remove everything from body/html other than these
return false; if (/^font|^(?:line-height|color)$|text-size-adjust$/.test(declaration.property)) {
return true;
} }
return true; return false;
}); });
} }
@ -72,6 +78,7 @@ function cleanupCss(str) {
selector = '.markdown-body'; selector = '.markdown-body';
} }
if (!/\.markdown-body/.test(selector)) { if (!/\.markdown-body/.test(selector)) {
selector = '.markdown-body ' + selector; selector = '.markdown-body ' + selector;
} }