3 ms·
Yes, you are. There is zero benefit in using XHTML with text/html. You can have lowercase tags and quoted attributes in HTML4 if you want so. You don't pollute
by rimantas 16y ago
Yes, you are. There is zero benefit in using XHTML with text/html.
You can have lowercase tags and quoted attributes in HTML4 if you want so. You don't pollute your markup with meaningless "/" which browsers treated as the invalid attribute anyway. Ok, it's not actually meaningless but <br /> in HTML(SGML) means completely different thing than in XML, only browsers did not
implement that part properly.
Is short: if you were using XHTML markup with text/html MIME, you were using marketing XHTML, which was parsed by browsers' engines as HTML not XML anyway.
If you were using application/xhtml+xml MIME type you'd know the difference.
It would be interesting to see how XHTML was "easier to manage across browsers" given that IE does not even understand XHTML.
I used XHTML for a short while before I learned what it actually meant. Then I switched to HTML4.01, now HTML5.
The nice thing about HTML5 is that it let's you have any syntax you want and it is not based neither on SGML nor XML.
- powrtoch 16y agoThanks for the info. Perhaps I just got better about writing clean markup around the same time I started using XHTML, and confused the two. I suppose now's as good a time as any for me to embrace HTML5.
- zokier 16y agoCould you explain the <br> vs <br /> difference in HTML? HTML5 spec says that void elements may optionally include slash[1], and from the wording I'd assume that it means that they should be treated equally. [1] http://dev.w3.org/html5/markup/syntax.html#void-element http://dev.w3.org/html5/markup/syntax.html#void-element
- mambodog 16y agoAs I understand it, basically the 'self-closing tags' are considered valid markup, but this comes under WHATWG's philosophy of trying to be inclusive as much existing markup that is out there as possible (within reason). This is in opposition to the strictness of XHTML's approach. This post by hixie indicates that self-closing tags are allowed to 'ease migration': http://lists.whatwg.org/pipermail/help-whatwg.org/2008-August/000137.html http://lists.whatwg.org/pipermail/help-whatwg.org/2008-Augus... I believe the 'spirit' of the spec would imply that <br> is the best practice when writing new markup. HTML5 maintains no pretence of being XML.
- rimantas 16y agoThis is actually very tricky subject. In short: HTML is SGML application, and in SGML features section (http://www.w3.org/TR/html401/sgml/sgmldecl.html http://www.w3.org/TR/html401/sgml/sgmldecl.html) it has this little tidbit: SHORTTAG YES. This allows the usage of so called null-end tags: ability to close the tag with a single character, which happens to be solidus ("/"). So in essence <br/> in HTML should mean the same as <br>>, i.e. "/" closes the tag and then ">" is just some text. If you try to validate document using xhtml markup as html you may get this warning from validator: NET-enabling start-tag requires SHORTTAG YES The sequence <FOO /> can be interpreted in at least two different ways, depending on the DOCTYPE of the document. For HTML 4.01 Strict, the '/' terminates the tag <FOO (with an implied '>'). However, since many browsers don't interpret it this way, even in the presence of an HTML 4.01 Strict DOCTYPE, it is best to avoid it completely in pure HTML documents and reserve its use solely for those written in XHTML. In XML (and hence XHTML) with the help of some mind-boggling trickery (Web SGML Adaptations Annex) you can have things like <foo/>
- yuhong 16y agoThe frustrating thing is that if not for IE, we could all have served real XHTML as application/xhtml+xml by now. Instead, we have to wait a year for IE9 to release, and then how many years for IE8 to finally become obsolete. And that when right now it is already almost 11 years after the release of XHTML 1.0.