logoalt Hacker News

raincolelast Tuesday at 5:55 AM2 repliesview on HN

> that browsers do try their best to render objectively broken markup

And it's a cancerous engineering principle. People say NullPointerException is the one billion error, but (the misuse of) Postel's Law on web frontend is a multi-billion error. Once one mainstream browser decided to "tolerate" an error, websites would start relying on that behavior, making it a permanent feature of web.

If browsers were less tolerant the whole frontend development would be much smoother. The past decade of JavaScript framework farce would have probably never happened.

The proper way to deal with syntax is making better tools: linters, interpreters and compilers that spew clear error messages. Not trying to 'tolerant' errors.


Replies

gldrklast Tuesday at 6:30 AM

Postel’s law allows a degree of forward compatibility. This was important before continuous software updates were practical. User-facing code is the best place to apply it: I want my text editor to highlight invalid source code on a best effort basis, whereas the compiler should promptly bail out.

tadfisherlast Tuesday at 6:16 AM

The tolerance is now precisely specified in the HTML5 parsing algorithm, far from "try their best". This is good, because browsers fail in mostly the same ways as each other, humans do not need a CS degree to handwrite Web content, and your tools can still write perfectly valid HTML5.

show 1 reply