--- name: frontend-debugging title: Frontend Debugging Patterns description: Non-trivial debugging patterns for static HTML/CSS/JS web apps — JS-overrides-HTML, missing script imports, cache-busting, and common pitfalls. --- # Frontend Debugging Patterns ## When Static HTML Edits Don't Take Effect **Check if JS dynamically generates the HTML at runtime.** This is the #1 cause of "I edited the file but nothing changed." - Search the JS files for `innerHTML`, `createElement`, `textContent =`, or DOM `appendChild` calls that target the same element IDs/classes - The DOM inspector in DevTools shows live state — if it differs from your source file, JS is overwriting it - Fix: edit the JS template string or the JS rendering function, not just the static HTML **Special case: color/readability fixes.** When a user reports "yellow on yellow" or "hard to read" and you fix the static HTML but they still see the old colors, the culprit is almost certainly a JS `innerHTML` template string that dynamically generates the colored elements. Search for `.innerHTML` in JS files and look for `text-yellow-*`, `bg-yellow-*`, or similar color classes — that's where the real fix lives. ## Missing Script/Module Imports A page element exists in HTML but has no event handler → the JS file that wires it up probably isn't loaded. - Check the `