3 ms·
Uh, yeah. Now that we have rules for parsing broken webpages, let's intentionally break our webpages.
by greglindahl 9y ago
Uh, yeah. Now that we have rules for parsing broken webpages, let's intentionally break our webpages.
- Tomte 9y agoThat‘s perfecly valid HTML. Try it. Pass it to a validator.
- greglindahl 9y agoAs I said, we now have rules for broken HTML like that. Yes, it validates. It's Postel's Law run amuck.
- chrismorgan 9y agoThe point is that this is legal HTML. The HTML spec does define all kinds of things as illegal (though it defines how the parser should handle them, for reasons of security and consistency), but these things are all legal. All have had the same behaviour forever, though omitting <html>, <head> and <body> tags being legal is, I believe, new to HTML 5. But the rest (e.g. not closing a paragraph tag and not using quotes on simple attribute values) have been legal from the very start, and even popular, though they have fallen out of favour for authoring in recent years. This is absolutely nothing to do with Postel’s law. I believe that Postel’s law is a terrible idea in most places—it leads to a lack of robustness in practice, and all kinds of security problems, because most programmers are frankly not good at their trade. Rather, the HTML spec defines all behaviour—so there is no liberality about it; you’re simply following the spec with no interpretation—which is the only way to write robust protocols and their implementations.
- azr79 9y agoHow is this broken HTML, it's valid HTML
- ferdbold 9y agoIf it complies to the spec, it's by definition valid syntax and suitable for production. Now whether or not you want that in your source code is totally up to you. Just because you can write your whole app in one line of JavaScript doesn't mean you should maintain that as source code. You sure want that as your production bundle though.