From d3b58b02a360d5c1b5ab8f9cf7d9b7f887e2d154 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Sun, 20 Sep 2026 20:03:28 -0700 Subject: [PATCH] The probe's two text-rect helpers say which text they read `__textLineRects` collected only the direct text once the line probe grew its own deep walk, so its name promised lines it no longer produced: it is `__directTextRects`, the list the union rect is built from. The snapshot's union helper takes the rects rather than the node now, and its comment says so. No behavior. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01LQBUunp8QttxZqihybNmtL --- browser-bundle/10-probe.js | 6 +++--- browser-bundle/15-snapshot.js | 4 ++-- crates/detect/src/design_system.rs | 9 ++++----- crates/live/assets/detect-antipatterns-browser.js | 10 +++++----- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/browser-bundle/10-probe.js b/browser-bundle/10-probe.js index 430646ed1..392e84728 100644 --- a/browser-bundle/10-probe.js +++ b/browser-bundle/10-probe.js @@ -70,8 +70,8 @@ function __collectTextRects(node, deep, out) { return out; } -// The element's own direct text, unmerged. -function __textLineRects(el) { +// The element's own direct text, unmerged: what the union rect is built from. +function __directTextRects(el) { return __collectTextRects(__el(el), false, []); } @@ -210,7 +210,7 @@ const __impeccableDom = { // getDirectTextRect(el) from the JS driver: union of the client rects of // the element's non-blank direct text nodes. direct_text_rect(el) { - const rects = __textLineRects(el); + const rects = __directTextRects(el); if (rects.length === 0) return []; const left = Math.min(...rects.map(r => r.left)); const top = Math.min(...rects.map(r => r.top)); diff --git a/browser-bundle/15-snapshot.js b/browser-bundle/15-snapshot.js index d13871da5..06a8bed7f 100644 --- a/browser-bundle/15-snapshot.js +++ b/browser-bundle/15-snapshot.js @@ -86,8 +86,8 @@ function __snapTextRects(node, out) { return out; } -// getDirectTextRect(el): union of the client rects of the element's -// non-blank direct text nodes (same measure as 10-probe.js). +// getDirectTextRect(el) over rects already collected: their union, as +// 10-probe.js#direct_text_rect builds it. function __snapDirectTextRectOf(rects) { if (rects.length === 0) return null; const left = Math.min(...rects.map(r => r.left)); diff --git a/crates/detect/src/design_system.rs b/crates/detect/src/design_system.rs index 08c0a9a22..4546fa7e0 100644 --- a/crates/detect/src/design_system.rs +++ b/crates/detect/src/design_system.rs @@ -45,11 +45,10 @@ re!( ); // A design document's prose, cut where one statement stops and the next // starts: punctuation, a line break, and the phrases that turn a sentence -// around. `instead of` / `rather than` open a -// clause about what the document is steering *away* from; the reversals -// (`outside`, `except`, ...) open one about what it is steering *toward*, -// which is what lets "no ALL CAPS outside the `.eyebrow` class" declare -// `.eyebrow`. +// around. `instead of` / `rather than` open a clause about what the document +// is steering *away* from; the reversals (`outside`, `except`, ...) open one +// about what it is steering *toward*, which is what lets "no ALL CAPS outside +// the `.eyebrow` class" declare `.eyebrow`. re!( DESIGN_CLAUSE_SPLIT, r"(?i)[.!?;:,()\[\]\n]|\u{2014}|\u{2013}|\binstead of\b|\brather than\b|\bas opposed to\b|\boutside\b|\bexcept\b|\bother than\b|\bunless\b|\bbesides\b|\bapart from\b|\bbeyond\b".to_string() diff --git a/crates/live/assets/detect-antipatterns-browser.js b/crates/live/assets/detect-antipatterns-browser.js index d6ce0209f..a350755f3 100644 --- a/crates/live/assets/detect-antipatterns-browser.js +++ b/crates/live/assets/detect-antipatterns-browser.js @@ -83,8 +83,8 @@ function __collectTextRects(node, deep, out) { return out; } -// The element's own direct text, unmerged. -function __textLineRects(el) { +// The element's own direct text, unmerged: what the union rect is built from. +function __directTextRects(el) { return __collectTextRects(__el(el), false, []); } @@ -223,7 +223,7 @@ const __impeccableDom = { // getDirectTextRect(el) from the JS driver: union of the client rects of // the element's non-blank direct text nodes. direct_text_rect(el) { - const rects = __textLineRects(el); + const rects = __directTextRects(el); if (rects.length === 0) return []; const left = Math.min(...rects.map(r => r.left)); const top = Math.min(...rects.map(r => r.top)); @@ -331,8 +331,8 @@ function __snapTextRects(node, out) { return out; } -// getDirectTextRect(el): union of the client rects of the element's -// non-blank direct text nodes (same measure as 10-probe.js). +// getDirectTextRect(el) over rects already collected: their union, as +// 10-probe.js#direct_text_rect builds it. function __snapDirectTextRectOf(rects) { if (rects.length === 0) return null; const left = Math.min(...rects.map(r => r.left));