mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-12 09:44:20 +01:00
Only strip out color, background, and font css properties
Prevents icon images from rendering super-huge.
This commit is contained in:
parent
8a85b18d09
commit
fcea33d61f
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user