what’s wrong with the XHTML transitional standard ? or XHTML strict for that matter, both of which support/require self closing tags as appropriate.
I agree with chradil, and am confused why you’d have a validation error. Am I Missing something graemep?
Add this to the top of the header.php of your theme:
function htmlize($buffer) {
return (preg_replace("!s*/>!", ">", $buffer));
}
ob_start("htmlize");
That will strip the self-closing bits.
Thanks Yngwin
Yosemite, self closing tags are not valid HTML. It is not a huge problem in practice because most browsers ignore the slash, but it is nice to get pages to validate.
chradil, I want to use HTML 4 because its the best way to get as many browsers as possible into standards mode. See this table.
XHTML strict also looks OK from this point of view, but I am more familiar with HTML.
I also need to use snippets of other code (web stats, ads etc) and these are more likely to be valid HTML than XHTML 1.0 strict. That said most of what I use at the moment does validate as XHTML 1.0 transitional so it SHOULD be OK.
Then there is the whole issue of sending XHTML as text/html, although I do not really understand what the practical implications of that are.
About usage of strict modes one should read
‘Strict Is Just Another Quirky Mode’
http://www.kdedevelopers.org/node/2097
Well, that’s just an opinion, and a limited one at that. I’m sure most standards-aware web developers don’t agree with that view.