From cfa36a413a4f99cbb390ee5bd486123bc7da160f Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 10 Oct 2026 11:16:07 -0700 Subject: [PATCH] =?UTF-8?q?Keep=20inline=20aspect-ratio=20on=20iframes=20s?= =?UTF-8?q?o=20embeds=20like=20Inoreader=E2=80=99s=20YouTube=20player=20do?= =?UTF-8?q?n=E2=80=99t=20collapse=20to=20150px=20tall.=20Fixes=20#5479.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Shared/Article Rendering/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Shared/Article Rendering/main.js b/Shared/Article Rendering/main.js index 73bbca4df..a670c402a 100644 --- a/Shared/Article Rendering/main.js +++ b/Shared/Article Rendering/main.js @@ -43,7 +43,11 @@ function stripStyles() { document.getElementsByTagName("body")[0].querySelectorAll("style, link[rel=stylesheet]").forEach(element => element.remove()); // Removing "background" and "font" will also remove properties that would be reflected in them, e.g., "background-color" and "font-family" // The stylesheet forces images to height: auto, so an author aspect-ratio box can't be filled by its image — content after the box overlaps the overflowing image. - document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => stripStylesFromElement(element, ["color", "background", "font", "max-width", "max-height", "position", "aspect-ratio"])); + // Iframes keep their aspect-ratio: without it an iframe with no pixel height collapses to the default 150px. + document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => { + const isIframe = element.tagName === "IFRAME"; + stripStylesFromElement(element, isIframe ? ["color", "background", "font", "max-width", "max-height", "position"] : ["color", "background", "font", "max-width", "max-height", "position", "aspect-ratio"]); + }); } // Constrain the height of iframes whose heights are defined relative to the document body to be at most