Forcing rails to output HTML4 rather then XHTML?

Uhu, completely agree. But I’ve noticed a lot of people are throwing around “HTML5” these days like “Web 2.0” in the recent past. The major difference being that HTML5 actually isn’t an empty shell like Web 2.0 was, but actually has a more-or-less well defined meaning.

Anyway, back to the “HTML4 rather than XHTML”, which has little to do with HTML5 anyway. IE6 perfectly supports XHTML and its
tags (with all of the usual IE6 quirks of course), so there is no reason to go to HTML4 if that is your concern.

Best regards

Peter De Berdt

...or not. Yes, of course it's fine to use new attributes that older browsers will ignore. However, HTML 5 differs from HTML 4 not just in its repertoire of attributes and elements, but also *in its basic syntax* -- HTML 5 is no longer a subset of SGML as HTML ≤4 is. That's he part that (potentially) breaks graceful degradation.

It breaks absolutely nothing. More than that, only because browsers don't give a damn about SGML rules all that XHTML nonsense was possible: according to SGML <br /> should be rendered as if it was <br> &gt; (search for SGML SHORTTAG).

Anyway, back to the "HTML4 rather than XHTML", which has little to do with HTML5 anyway. IE6 perfectly supports XHTML and its <br /> tags (with all of the usual IE6 quirks of course), so there is no reason to go to HTML4 if that is your concern.

IE6 (and any version of IE) does not support XHTML at all. Try to feed them proper XHTML (that's with the MIME type application/xhtml+xml) and see what happens. They just silently ignore all those slashes.

HTML5 finally fixes this, and you can use a syntax you like for your HTML5 documents. However, if you want XHTML5 you MUST server your document with application/xhtml+xml: and by doing so be aware of all the differences in behaviour this brings.

Regards, Rimantas

Rimantas Liubertas wrote in post #957137:

...or not. Yes, of course it's fine to use new attributes that older browsers will ignore. However, HTML 5 differs from HTML 4 not just in its repertoire of attributes and elements, but also *in its basic syntax* -- HTML 5 is no longer a subset of SGML as HTML ≤4 is. That's he part that (potentially) breaks graceful degradation.

It breaks absolutely nothing.

You cannot possibly know this with certainty, I think. Since non-HTML5-aware browsers use SGML syntax in non-XHTML documents, HTML5 self-closing tags shouldn't be interpreted as self-closing tags (and are invalid HTML4 due to the trailing >). The fact that, in practice, most browsers are lenient in this respect doesn't mean that this behavior should be relied on.

More than that, only because browsers don't give a damn about SGML rules all that XHTML nonsense was possible:

I think you've got it backwards. Self-closing XML-tags only became necessary to support in browsers when XHTML was introduced. Before that, no one would have thought to use them, and so SGML parsing could (and perhaps should) have been the order of the day.

according to SGML <br /> should be rendered as if it was <br> &gt; (search for SGML SHORTTAG).

Right. So the trailing > isn't valid HTML4, so you can't assume that you can use it (outside an XHTML context) in a pre-HTML5 browser.

Anyway, back to the "HTML4 rather than XHTML", which has little to do with HTML5 anyway. IE6 perfectly supports XHTML and its <br /> tags (with all of the usual IE6 quirks of course), so there is no reason to go to HTML4 if that is your concern.

IE6 (and any version of IE) does not support XHTML at all. Try to feed them proper XHTML (that's with the MIME type application/xhtml+xml) and see what happens.

I think this was finally fixed in IE7, IIRC.

They just silently ignore all those slashes.

Right.

HTML5 finally fixes this, and you can use a syntax you like for your HTML5 documents. However, if you want XHTML5 you MUST server your document with application/xhtml+xml: and by doing so be aware of all the differences in behaviour this brings.

Yup.

Regards, Rimantas

Best,

Robert Walker wrote in post #957044:

Marnen Laibow-Koser wrote in post #956924:

Right. But when the syntax -- not just the semantics -- changes, then I start worrying. Time for me to do more research.

Okay, so let's talk specifics. Assuming valid HTML 5 markup with no HTML 5 specific features, what breaks on what browsers.

Valid HTML 5 markup (with XML-style self-closing tags) is invalid HTML 4 markup (because, as Rimantas said, in HTML 4, <br/> is equivalent to <br>>, with an invalid extra >). That's all you need to know to know that this is a bad thing.

Best,

Marnen Laibow-Koser wrote in post #957260:

Robert Walker wrote in post #957044:

Okay, so let's talk specifics. Assuming valid HTML 5 markup with no HTML 5 specific features, what breaks on what browsers.

Valid HTML 5 markup (with XML-style self-closing tags) is invalid HTML 4 markup (because, as Rimantas said, in HTML 4, <br/> is equivalent to <br>>, with an invalid extra >). That's all you need to know to know that this is a bad thing.

I'm was not asking about validity. Markup validity is directly dependent upon the DOCTYPE specified for the page.

What I'm trying to find out is specifically how IE 6 breaks (as in incorrectly renders the page) when using valid HTML 5 markup (including self-closing tags) with <!DOCTYPE html>. Again assume no HTML 5 only features only markup syntax.

I'm asking because I don't personally use any version of IE, much less IE 6. I'd really like to know if IE 6 actually has problems rending HTML 5 markup.

I haven't tried it myself, and I upgraded my test machine to IE8 at the beginning of the summer, but I believe that it treats it like "tag soup" and ignores any tag that it doesn't understand. That is, it shows the content of that unknown tag, but it doesn't apply any special meaning to the tag. It would likely be Quirks Mode all the way down, definitely not something that looked like you cared about that browser, but it would be readable in the sense that all the words would be there.

Walter

Walter Davis wrote in post #957346:

that this is a bad thing.

I'm asking because I don't personally use any version of IE, much less IE 6. I'd really like to know if IE 6 actually has problems rending HTML 5 markup.

I haven't tried it myself,

Nor have I.

and I upgraded my test machine to IE8 at the beginning of the summer, but I believe that it treats it like "tag soup" and ignores any tag that it doesn't understand. That is, it shows the content of that unknown tag, but it doesn't apply any special meaning to the tag. It would likely be Quirks Mode all the way down, definitely not something that looked like you cared about that browser, but it would be readable in the sense that all the words would be there.

That would be my guess as well.

Walter

Best,

What I'm trying to find out is specifically how IE 6 breaks (as in incorrectly renders the page) when using valid HTML 5 markup (including self-closing tags) with <!DOCTYPE html>. Again assume no HTML 5 only features only markup syntax.

I'm asking because I don't personally use any version of IE, much less IE 6. I'd really like to know if IE 6 actually has problems rending HTML 5 markup.

It does not break. The only thing that doctype affects in IE6 is rendering mode. HTML5 doctype forces IE6 into "standards compliant" mode, see [1] for more details. In fact, because unknown doctype (which html5 doctype was for earlier browsers) forces them to use standards rendering mode is THE reason HTML5 has doctype at all. You can omit doctype for your XHTML5 pages, because they MUST be served with application/xhtml+xml MIME type and then it is this MIME that tells browsers how to treat you document, no doctype necessary.

So if your web page was using any of doctypes which would cause IE to be in standards compliant mode it will behave just the same with HTML5 doctype.

However, if your page was developed for quirks mode, HTML5 doctype will switch IE6 into standards compliant rendering and things may (will?) break horribly. The most probable case is different box model, but there are other differences too, see the link below for the details.

[1] Internet Explorer for Developers | Microsoft Learn

Regards, Rimantas