Johny P. Johny P. - 1 year ago 82
HTML Question

W3C no longer maintaines polyglot markup?

W3C has ended support for the polyglot markup. So do I have to convert my site to use regular HTML5 instead of XHTML? How would them abandoning this concept affect existing sites? I want to have a perfectly valid markup and if that code conflicts with what is the standard, I will have to remove it.

Answer Source

As usual more bashing in comments against XHTML without any true comprehension of what it is.

  • XHTML uses the XML parser.
  • HTML uses the HTML parser.

  • The XML parser is strict, it is an application with low tolerance for error.
  • The HTML parser is relaxed and doesn't mind if the screen door is open on your submarine.

You can and should use the strictest tools available to you. In example in PHP you should always check if a variable isset. Why? Hackers will remove an input element from a form, submit the form and then try to see what error messages the server would send. But if you lower the strictness of PHP's error messages you would think everything is fine and dandy.

I saw a guy stress out for three days over why only Safari wouldn't render a certain style correctly. If he had used the XML parser the page would have (in Firefox) completely failed and he would have gotten an error message pointing out exactly what the error is, what line it's on and what column on that line (other browsers render up to the line so use Firefox for testing by default). His error? He was missing a double quote around one of his attributes; the screen door was wide open on his submarine.

This does not imply you can't use HTML5 because we're talking syntax here. Ideally you should be using XHTML5, HTML5 using the XML parser. It doesn't catch all issues (duplicate id attribute values in example) though it will require you to code on a higher level.

Yeah, IE8 doesn't support XHTML (it kind of supports XML) but it's not even worth considering supporting IE8. Frankly it's the only browser that has any "significant" market share that doesn't support XHTML though this doesn't mean you can't do content negotiation:

if (stristr($_SERVER['HTTP_ACCEPT'],'application/xhtml+xml'))
 header('Content-Type: application/xhtml+xml');
 echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";

Keep in mind that IE8 will render in quirks mode if it sees the XML declaration though as of 2016 that is a moot point since it's no longer a browser worth supporting unless you're being paid as a specialist specifically to deal with that browser.

My whole platform uses XHTML5 and it has greatly improved standards, development time and skillset. Always question the integrity of people who speak against doing something that requires more skill, there is a reason why the saying a dime a dozen exists.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download