Search code examples
htmlwell-formed

HTML5 and well-formedness


I'm looking into HTML5 and I'm puzzled why it goes so easy on well-formedness.

<div id="main">  
<DIV ID="main">  
<DIV id=main>

are all valid and produce the same result. I thought with XHTML we moved to XML compliant code at no cost (I don't count closing tags as a cost!). Now the HTML5 spec looks to be written by lazy coders and/or anarchists. The result is that from the start of HTML5 we have two versions: HTML5 and the XML compliant XHTML5. Would you consider it an asset if C would suddenly allow you to write a for construct in the following ways?

for(i = 0; i < 10; i++) {  
for(i = o; i < 1o; i++) {  // you can use "o" instead of "0"  
for(i = 0, i < 10, i++) {  // commas instead of semicolons are alright!  

Frankly, as an XHTML coder since many moons I feel a bit insulted by the HTML5 spec.
Wadya think?
Steven

edit:
Mind the "wadya": would you as a customer accept a letter with "wadya" written instead of "What do you"? :-)


Solution

  • HTML 5 is not an XML dialect like XHTML is.

    What made HTML so popular was the fact that it tolerated mistakes, so just about anyone could write an HTML page.

    XHTML made it much more difficult and it didn't get widely adopted. At the same time, further development of HTML/XHTML stagnated, so an industry group formed up, the WHATWG who started work on the next generation of HTML and decided to revert to a non XML standard for HTML 5.

    Since XML is stricter than HTML, you can always write your HTML to be XML compliant. Make sure attributes are in lower case, use value delimiters, elements have closing tags and use correct XML escaping where needed.