Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Now that HTML5 has a standard algorithm for rendering pages, will it still be useful to validate markup?

Tags:

html

HTML5 defines a standard algorithm for rendering web pages, and this algorithm specifies how error handling should be performed. All in all, every single browser should render invalid markup the same way, or should fail the same way for tags they can't handle.

Right now I can still see validation as a means to ensure markup works hypothetically the same on legacy browsers. Excluding those (because hopefully they won't be around forever), since any kind of markup should have a defined behavior no matter how horrible it looks, does "valid HTML" still have any meaning? It seems to me that an input is valid if it has a defined output, and in this case it means that any HTML5 is valid. Is it still useful to validate markup considering that it won't impact compatibility?

As linepogl rephrased it in a comment, now that invalid HTML is standardized, has it become valid?

like image 824
zneak Avatar asked Mar 10 '11 19:03

zneak


2 Answers

I imagine validators will remain a useful tool for HTML in the same way that lint and its descendants remain useful tools for general programming languages. That is, even if the compiler (the browser) behaves in a predictable way according to the language standard (which is overly optimistic anyway), it's still useful to perform a more thorough check for unsavoury constructs in your code.

like image 63
John Bartholomew Avatar answered Nov 18 '22 09:11

John Bartholomew


To put it in terms of a car analogy:

In the UK we generally know the consequences of our actions if we break the speed limit while driving. We'll get a fine and 3 endorsement points on our licence. But just because we know the consequences doesn't mean that it's any less of an offence.

Same applies with HTML. Error handling behaviour has been standardised because it's such a common occurance, but that doesn't make using illegal syntax valid. Legal syntax is more efficient for browsers to render, and infinitely easier to maintain, so although the outcome of invalid markup is predictable, it's much better for everyone concerned if we stick to the rules.

... Stay in school kids! </preach>

like image 21
Karl Nicoll Avatar answered Nov 18 '22 09:11

Karl Nicoll