/* The probe. Runs inside the page under test and writes its findings into the document title, which is the one channel headless Chrome will hand back through --dump-dom. Read by tests/test_visual.py. */ document.addEventListener("DOMContentLoaded", function () { var doc = document.documentElement; var report = { overflow: doc.scrollWidth - doc.clientWidth, wide: [], spill: [], panels: [] }; /* An element crossing the viewport edge is only a fault if nothing between it and the page is a scroll container. `.tablewrap` exists precisely so a twelve-column table can scroll on its own; that is a design decision, not a bug, and a check that cannot tell the two apart gets switched off. */ function scrollableAncestor(el) { for (var p = el.parentElement; p; p = p.parentElement) { var o = getComputedStyle(p).overflowX; if (o === "auto" || o === "scroll" || o === "hidden") return true; } return false; } document.querySelectorAll("body *").forEach(function (el) { var r = el.getBoundingClientRect(); if (r.width > 0 && r.right > doc.clientWidth + 1 && !scrollableAncestor(el)) { report.wide.push(el.tagName.toLowerCase() + (el.className && typeof el.className === "string" ? "." + el.className.split(" ")[0] : "") + "@" + Math.round(r.right)); } }); /* Text outside its own box. A 29px number in a 170px tile does not widen the document — the tile clips or the glyphs simply hang out — so the overflow check above never sees it. Compare each leaf's scroll width against its client width instead. */ document.querySelectorAll(".tile, .m-tile, .chartcard, .panel, button, .fytabs a") .forEach(function (el) { if (el.scrollWidth > el.clientWidth + 2 && getComputedStyle(el).overflowX === "visible") { report.spill.push(el.tagName.toLowerCase() + (el.className && typeof el.className === "string" ? "." + el.className.split(" ")[0] : "") + " content=" + el.scrollWidth + " box=" + el.clientWidth); } }); /* ── the floating panels ────────────────────────────────────────────── Everything above measures the page as it FIRST renders, which means every