Home » HTML » HTML_QuickForm » Bug #5048
Make XHTML-compliant output optional; default to HTML-output
Details
| Request #5048 | Make XHTML-compliant output optional; default to HTML-output |
|---|---|
| Submitted | 2005-08-09 23:46 UTC |
| From | crisp at tweakers dot net |
| Status | Wont fix |
| Package | HTML_QuickForm |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2005-08-09 23:46 UTC] crisp at tweakers dot net
Description:
------------
Make the 'XHTML'-compliant output optional; XHTML is not usable in the real-world and strictly taken XHTML syntax is invalid HTML-syntax. Else consider renaming the project to XHTML_QuickForm.
[2005-08-10 09:01 UTC] crisp at tweakers dot net
1) The world's most used browser (Internet Explorer) doesn't support XHTML; it doesn't have an XHTML-rendering mode and doesn't even support the XHTML-mimetype.
This is why most authors use the text/html mimetype, which effectively means that every browser will treat the document as HTML. Moreso, most authors don't even conform to the compatibility guidelines and even rely on features that HTML has and XHTML hasn't - meaning most XHTML documents won't even work when treated as XHTML.
So XHTML as text/html is just HTML to the browser. You can't use specific XHTML features when using the text/html mimetype. There is a big misunderstanding that XHTML is more strict than HTML - that is simply not true. Especially when used as text/html the only difference is in the syntax and the DTD (but browsers generally don't use the DTD at all - it's all in the mimetype).
Although the syntax difference is only minor, there is one important issue, which brings me to 2)
2) HTML is a SGML-application and should follow the SGML rules for syntax. It is allowed in SGML to close a tag using a SHORTTAG, namely /
This means that basically something like <br /> should result in a linebreak followed by an unencoded forward sign - which is invalid as content since that character has special meaning and therefor should be encoded.
Offcourse most browsers don't support the NET feature and just ignore it, but the fact that it is invalid SGML syntax (and thus invalid HTML syntax) remains; a tag cannot contain character data besides valid boolean attributes and attribute-value pares; and even then values containing characters such as / should be enclosed in quotes.
Another (althoug minor) issue is the syntax of boolean attributes. Older browsers may not support the boolean="boolean" syntax, so in HTML the short notation is preferred.
An option for choosing between HTML and XHTML-syntax output would therefor be appreciated, especially for those that do not go along with the XHTML-hype and want to author valid HTML pages. It shouldn't be difficult to implement either :)
[2005-08-10 16:11 UTC] crisp at tweakers dot net
1) Quirksmode or standards-compliant mode rendering in IE has nothing to do with HTML or XHTML. It is true that IE performs some kind of DTD sniffing, but this does not distinguish XHTML from HTML since IE *can* only render as HTML.
2) Just because most browsers accept XHTML-syntax as HTML doesn't make it correct. It involves error-handling within the browsers parser.
Just because you don't see any merit in this request doesn't make it 'Bogus', others may want to use HTML_QuickForm within HTML without seeing it polluted with XHTML-syntax when it is not required. And it doesn't seem like a whole lot of work to implement to me.
Personally I do not want to go into the HTML vs XHTML discussion again; I've done that too many times. I just want to be able to use HTML and tools that don't force XHTML-syntax upon me...
[2005-08-10 17:07 UTC] bmansion at mamasam dot com
So far we only have had requests to make QuickForm more XHTML compliant, never the other way around. Like you, given the state of the industry, I don't really care about XHTML in HTML browsers. But making a version especially for HTML would be a pain in the back and would also certainly bloat the code a bit more. So it's a no-go.
[2005-08-10 20:02 UTC] crisp at tweakers dot net
Sure, every feature would bloat the code a bit more ;)
As in this case all you probably need is some defines for the boolean attributes and a define for the XHTML close tag; something like
if (isset($config['no_xhtml_syntax']) && $config['no_xhtml_syntax'] == true)
{
define('XHTML_CLOSE_TAG', '');
define('ATTRIBUTE_CHECKED', 'checked');
define('ATTRIBUTE_SELECTED', 'selected');
}
else
{
define('XHTML_CLOSE_TAG', ' /');
define('ATTRIBUTE_CHECKED', 'checked="checked"');
define('ATTRIBUTE_SELECTED', 'selected="selected"');
}
...
echo '<input type="checkbox" ' . ATTRIBUTE_CHECKED . XHTML_CLOSE_TAG . '>';
But when there is no interest, too bad; I'll probably have to hack the code myself...