DEV Community

Ryan
Ryan

Posted on

Do validate your HTML

I'd been pulling my hair out trying to get a perfect score in Chrome's Lighthouse audit. I had only a few tiny icons, not many deeply nested elements, no blocking javascript, I had used preload tags to avoid request chains, and the page sure seemed fast to me. There was no reason I should be capped at 95 for performance. But the audit would always tell me 900ms was being spent on "Unattributable." Gee, very helpful!

A post I happened to read here on DEV linked the W3 Validator so I thought what the heck, let's see if anything is wrong, and ran my site through it. Sure enough I had a few mismatched tags. And wouldn't you know it, fixing that made the problem go away and showed me those beautiful fireworks.

Most browsers will silently fix mismatched tags, so you won't notice any errors on the site or console and it will even be corrected in the source code. But I suppose this makes the renderer waste some time re-parsing the DOM -- not enough for me to notice on my notebook, but substantial on Lighthouse's simulated slow device.

Top comments (0)