Merge pull request #1497 from Wevah/allow-size-styles-ios

Only strip color/font inline styles
This commit is contained in:
Brent Simmons 2019-12-31 13:50:37 -08:00 committed by GitHub
commit 73b9d03fac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -8,10 +8,18 @@ function wrapFrames() {
}); });
} }
// Strip out all styling so that we have better control over layout // Strip out color and font styling
function stripStylesFromElement(element, propertiesToStrip) {
for (name of propertiesToStrip) {
element.style.removeProperty(name);
}
}
function stripStyles() { function stripStyles() {
document.getElementsByTagName("body")[0].querySelectorAll("style, link[rel=stylesheet]").forEach(element => element.remove()); document.getElementsByTagName("body")[0].querySelectorAll("style, link[rel=stylesheet]").forEach(element => element.remove());
document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => element.removeAttribute("style")); // Removing "background" and "font" will also remove properties that would be reflected in them, e.g., "background-color" and "font-family"
document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => stripStylesFromElement(element, ["color", "background", "font"]));
} }
// Convert all image locations to be absolute // Convert all image locations to be absolute

View File

@ -221,12 +221,6 @@ img[src*="share-buttons"] {
display: none !important; display: none !important;
} }
/* Site specific styles */
.wp-smiley {
height: 1em;
max-height: 1em;
}
/* Newsfoot specific styles. Structural styles come first, theme styles second */ /* Newsfoot specific styles. Structural styles come first, theme styles second */
.newsfoot-footnote-container { .newsfoot-footnote-container {
position: relative; position: relative;