Joel Birch schrieb:
> On 01/02/2007, at 1:48 PM, John Resig wrote:
>> innerHTML works just fine on XHTML pages - jQuery.com is XHTML.
> 
> Ah yes, I meant XHTML served as XML not text/html. Are you saying  
> that innerHTML works even when served as an application of XML? If  
> so, I stand gratefully corrected.
> Joel.

It is a common misunderstanding amongst web developers that using an 
XHTML Doctype on top of a document makes it XHTML. It's not, it's 
actually still HTML with some weird slashes here and there where they 
don't belong. The document will still be parsed by the HTML tag soup parser.

The reason why this works at all is that the HTML parsers are pretty 
error prone and will ignore these slashes. Nonetheless the W3C 
recommends to follow the HTML Compatibility Guidelines when using XHTML 
but serving it as text/html:
http://www.w3.org/TR/xhtml1/guidelines.html

But then people even put an XML declaration on top and serve it as 
text/html...

To sum it up: "MIME types matter; DOCTYPEs don't" (Anne van Kesteren, 
http://annevankesteren.nl/2004/07/mime).

If you're serving as text/html it is always HTML. If you're serving as 
application/xhtml+xml it's XHTML. I do that as an exercise on my own 
blog. Beware of draconian error handling and some subtle but important 
differences for style sheets and DOM scripting.

With IE 7 not supporting true XHTML I consider XHTML pretty dead for at 
least the next few years. And have started to switch back to HTML 4 Strict.


-- Klaus



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to