From b34e0949a03040b231b6fec2d6592611d3cf2b0d Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Tue, 17 Mar 2026 16:35:23 -0700 Subject: [PATCH] Fix browser nested cards: WeakSet not iterable, match CLI heuristic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WeakSet.prototype[Symbol.iterator] doesn't exist — can't use for..of. Changed to Set (same fix as CLI). Also updated isCardLike heuristic to require shadow or border as mandatory, matching the CLI. Co-Authored-By: Claude Opus 4.6 (1M context) --- public/js/detect-antipatterns-browser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/js/detect-antipatterns-browser.js b/public/js/detect-antipatterns-browser.js index 40f568533..276d4d2c9 100644 --- a/public/js/detect-antipatterns-browser.js +++ b/public/js/detect-antipatterns-browser.js @@ -284,14 +284,16 @@ const hasRadius = parseFloat(style.borderRadius) > 0 || /\brounded(?:-sm|-md|-lg|-xl|-2xl|-full)?\b/.test(cls); const hasBg = (style.backgroundColor && style.backgroundColor !== 'rgba(0, 0, 0, 0)') || /\bbg-(?:white|gray-\d+|slate-\d+)\b/.test(cls); const hasBorder = /\bborder\b/.test(cls); - return [hasShadow, hasRadius, hasBg || hasBorder].filter(Boolean).length >= 2; + // Must have shadow or border (the key card indicator), plus rounded or bg + if (!hasShadow && !hasBorder) return false; + return hasRadius || hasBg; } function checkLayout() { const findings = []; // --- Nested cards --- - const flaggedEls = new WeakSet(); + const flaggedEls = new Set(); for (const el of document.querySelectorAll('*')) { if (!isCardLike(el) || flaggedEls.has(el)) continue; const cls = el.getAttribute('class') || '';