Practice ยท Content & Rendering
Broken Images
Why this is tricky
An <img> tag exists in the DOM whether or not its image actually loaded โ document.querySelector finding it proves nothing. The real check is img.complete && img.naturalWidth > 0, or listening for the element's error event.
Valid image
Broken path (404)
Empty src
Initial state.