Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> If the browser misinterprets, you have a hard time finding out what went wrong.

This is what HTML validators are for.

Browsers should do their best to interpret the page authors intention and actually display a page. The developer doesn't always have 100% control over the page markup (think about user generated content, ads etc...)



Why can't the browser be the validator itself? You load the page and the browser tells you what's wrong with the code.


This would work as long as the browser was in a dev mode. Usability would suffer if normal users had to deal with errors in the pages that they visit.


Sorry, that's silly. Web pages break all the time.

If they would break because of invalid HTML, they would also already break during your tests.

If you use some HTML injection services like ads or analytics that make valid HTML invalid, then it's great that it breaks because it will show you immediately on your tests that these services suck.


What if you have no choice but to rely on those services? The person coding the site isn't always the decision maker.


Yes but you have an error in your reasoning.

If browsers would error out on invalid content then those services would either provide valid content or they would go bust.

And XML/XHTML is much easier to parse and for producing valid content than HTML because it is much more consistent and has less history package than HTML.

It is just that today, we still have tag-soup and error-tolerant parsers in the browsers and of course lots and lots HTML producer are producing shitty HTML and you can't just switch on a strict parsing.

But if history would have taken a slightly different turn, we would be talking about XHTML5 and not HTML5.


That's a good point, but I wasn't necessarily thinking it should error out to render nothing at all.

What I would like is if somehow the browser could insert an error class name into the offending element so that in my CSS I could give it a set of rules to make it stand out after render.


Users shouldn't have to care about this. If the browser can render the page it should.

This does raise the point that perhaps browsers should have a development mode that does raise errors though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: