Page is a not externally linkable
- Code, Content, and Presentation
-- HTML
---- Why most of us should NOT use XHTML


encyclo - 3:31 pm on Apr 2, 2006 (gmt 0)


You can get away with XHTML-style trailing slashes because there is no user agent which actually implements SHORTTAG minimisation - HTML is based on SGML and the minimisation aspect comes from there. XHTML is XML-based, where such minimisation is not permitted.

A document is always parsed in relation to the MIME type not the doctype, so if you serve XHTML as text/html then the user agent will treat it as ordinary HTML. The trailing slashes are ignored because SHORTTAG minimisation is not implemented, so they are treated as unknown attributes in the same way as any other non-existent or erroneous attribute.

Is XHTML syntax served as text/html "harmful"? Only partially. Using XHTML syntax in HTML documents will function correctly in just about every known user agent in existence, so it can be considered safe. However is is harmful in terms of perception: most would consider a valid XHTML page as being "forwards-compatible", however in very many cases, simple validation isn't enough to guard against problems in converting or parsing such documents as true XHTML later on.

XHTML may well just be a dead-end technology anyway. The browser companies (Mozilla, Opera, KDE, Apple) are not interested in pursuing XHTML and have put their efforts towards WHAT-WG [whatwg.org] and its plans for "HTML 5". Microsoft is not interested in XHTML either, prefering XAML/Avalon (its proprietary solution).

Mozilla's Web Author FAQ [mozilla.org] offers a clear recommendation for those undecided between HTML 4.01 and XHTML:

Serving valid HTML 4.01 as text/html ensures the widest browser and search engine support.

HTML 4.01 Strict is the clear winner, at least until WHAT-WG's HTML 5 is finalized.

Note: Ian Hickson, who wrote the original article referenced in the first post of this thread, used to work for Mozilla, and subsequently worked for Opera Software and now Google inc. He is the spokesman for WHAT-WG who are developing the HTML 5 specifications.

[edited by: encyclo at 3:46 pm (utc) on April 2, 2006]


Thread source:: http://www.webmasterworld.com/html/12026.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com