Raymond Irving wrote:
I'm thinking about using the html5 doctype for all html documents since it's supported by all the popular browsers available today.
Two Quick questions...
Why do we need to send XHTML code to a web browser when standard html code
(with html 5 doctype) will do just fine?
In most cases we don't.
However if we want to include extensions (such as MathML etc.) then
xhtml is the only way to do it.
My own reason for sending xhtml is because I believe it to be a superior
specification and would like to see html (where not all tags need to be
closed) go away.
Having valid x(ht)ml output also means that other software that uses
your web page as a source for data can just parse it as xml to get the
data it needs.
Be careful with html 5 - use the fallbacks (IE embed or object for video
as a fallback to the video tag), because not everyone uses the latest
Is there any advantage of using xhtml in the web browser over html for normal
web application development?
In most cases, not a display advantage.
HTML 1.1 supports the ruby tags/attribute, html 4 does not, but with
html 5 / xhtml 5 - they are supposedly identical in spec with the only
difference being the markup semantics of xhtml 5 conform to xml
standards. I suspect html 5 elements/attributes are case insensitive
(like they are for previous html) but I haven't checked - xhtml
tags/attributes need to be lower case.
But if your page can be properly displayed with valid html then the only
technical advantage I can think of for using xhtml is for apps that use
your page as a data source (so they don't have to convert it to xml).
I personally will send xhtml most of the time when I can because I want
HTML to go away, and as soon as 97% of browsers properly support xhtml,
I may stop sending html all together. Since IE 8 still does not (not
will correct mime type anyway) it will be years before that happens.
Oh - another advantage to xhtml - it's easy to extend for your own use.
For example, you can add a custom attribute for your own use (IE as
hooks for other web apps on other sites to use when grabbing data from
your site, or whatever) and it will validate as long as you properly
declare it. With html, I believe adding an attribute is not allowed
unless you create a whole new DTD.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php