Fix browser nested cards: WeakSet not iterable, match CLI heuristic

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) <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-03-17 16:35:23 -07:00
co-authored by Claude Opus 4.6
parent add8c1958d
commit b34e0949a0
+4 -2
View File
@@ -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') || '';