Valid HTML4.01
This blog is now valid HTML4.01 strict! By default, WordPress uses XHTML with a text/html mime type, which I think is an abysmal choice. And I don’t care much for XHTML anyway (HTML4 with WhatWG extensions is the future of the web), so I hacked my theme a little bit more and wrote a little WordPress plugin which disables a few XHTMLiries that WordPress uses by default; these combined changes make this blog validate as HTML4.01 strict.
January 16th, 2006 at 7:03 pm
I coughed hard when I read that. Dislike XHTML? My god, what’s wrong with some true well-formedness and syntax?
And this post didn’t pass the validation…
http://validator.w3.org/check?uri=http%3A//benjamin.smedbergs.us/blog/2006-01-16/valid-html401/
“Error Line 66 column 9: end tag for element “DIV” which is not open.”
January 16th, 2006 at 7:29 pm
Congratulations! Is your plugin suitable for redistribution? I had been looking for something to do that, but couldn’t find anything. And I don’t want to upset the mysterious entry fields of WordPress.
January 16th, 2006 at 8:08 pm
@ulrik: It validates for me using the link you posted. As for a reason to switch to HTML, here’s a nice article on the subject. Believe it or not, it’s just as easy to write well-formed/valid HTML as it is XHTML.
@Benjamin: Kudos on switching to XHTML. I’m going to using WP 2.0 for a site I’m developing, and I was looking for a way to get it to output valid HTML 4.01. Would you mind posting your plugin? It would be really helpful.
January 16th, 2006 at 9:01 pm
Great stuff. There are so few legitimate real-life uses of XHTML that it’s not even funny.
Ulrik, XHTML sent as text/html is pointless, it might as well be HTML Strict, the syntax is just as good, the benefits still remain and there are no real disadvantages. Conversely, serving XHTML incorrectly can be harmful and is bad practise in general.
January 16th, 2006 at 9:36 pm
I’ve heard from many people that they don’t like XHTML, but I haven’t found why. I don’t know much about the difference between them, except for the well-formedness of XHTML, so can someone please enlighten me to the advantages of HTML over XHTML.
January 17th, 2006 at 2:31 am
Navid:
XHTML sent as text/html is treated as HTML with syntax errors (e.g. the short close tags are not supported in html) so i would say sending the page as HTML in the first place saves the parser a bit of time he needs to look over all these “syntax errors”.
*real* XHTML sent as application/xhtml+xml has other very good advantages. E.g. you can use SVG inline and modify it with Ecmascript/DOM.
And the only browser who does not know application/xhml+xml is Internet Explorer. And its only a matter of time till the user stats become negligible.
As for me, i use *real* XHTML and ignore the IE for my personal projects.
January 17th, 2006 at 3:40 am
I salute your conversion to HTML 4.01 strict. I did the same with my website a few months ago after reading
Say NO to XHTML and
Sending XHTML as text/html Considered Harmful
The Nvu User Guide, which is in the process of being translated, also recommends to users to choose HTML 4.01 strict.
Take care,
Gérard
January 17th, 2006 at 3:41 am
Navid: Exactly. This is much ado about nothing
January 17th, 2006 at 3:51 am
http://www.hixie.ch/advocacy/xhtml
January 17th, 2006 at 8:42 am
I visit only XHTML pages so I won’t come back. Bye.
January 17th, 2006 at 10:37 am
“I visit only XHTML pages so I won’t come back. Bye.”
Oh wow :)
Personally, I prefer the idea of properly served XHTML, so at some point in the near future I’ll remove all text/html content from my site. In practise, text/html is going to be all the XHTML1.x is ever served as commercially, so yeah, we might as well use HTML. When XHTML2.0 rolls in we can re-evaluate (and at that point I hope the nay-sayers won’t stick with HTML + non-w3c extensions).
January 17th, 2006 at 6:08 pm
“HTML4 with WhatWG extensions is the future of the web”
Dream on. :)
HTML has no advantages over XHTML, it’s just harder to parse and not extensible.
I am serving my XHTML code as XML, if the user agent wants it. And it works great, except for Opera 8.5.
January 18th, 2006 at 11:59 pm
Plain HTML’s sloppiness, as well as the sloppiness of WYSIWYGS and some browsers (IE), is the reason why modern standards (say, post 1998) don’t have the penetration they should. Aside from the fact that few have the cajones to refuse to abuse tables. (number of tables I added to sites last year: about -50)
HTML also has poor semantics to go with the inconsistent syntax mentioned by others.
HTML5 wants to go back to presentational attributes and other ugly stuff. XHTML2 is furthering the separation of content and presentation.
While you’re at it, you might as well uninstall WordPress, open HoTMetaL Pro and start FTPing static pages to your server.
January 19th, 2006 at 12:29 pm
@Dao, Dracos: Here’s what I don’t think you get. When you send XHTML as text/html, you’re not sending XHTML at all. You are sending broken, invalid HTML. You get none of the benefits of XHTML. If you really love XHTML so much, either send only application/xhtml+xml, or use maintain an XHTML version and an HTML version of your site, and switch between them using content negotiation. (If anybody actually does this, please post a link; I’ve never seen it on a real-life Web site.)
As for XHTML 2, who knows when it will be ready? And when it is, it won’t be practical to use it on real-world sites for quite some time. I think the WHATWG holds the future of the Web. HTML 5 is backward compatible, but has several improvements, including clearer, stricter parsing. And yes, it even comes in an XML version for all you XHTML fans out there.
January 19th, 2006 at 6:04 pm
Stupid typos. :-) s/use maintain/maintain/ in the above.
January 19th, 2006 at 8:39 pm
Jonathan, HTML user agents don’t care getting this “invalid HTML” since they’re used to handle far worse code and XHTML 1.0 has the same semantics as HTML 4.01. So yes, I could strip the few slashes automatically, but I don’t see how anybody would benefit from that.
January 21st, 2006 at 8:04 pm
Well, I’m sorry for ranting earlier. :-( I guess I’m just tired of seeing this debate come up again and again. Personally, I still think that HTML is better than XHTML, but in the end it’s the webmaster’s choice. Creating a useable and accessible Web site is what really matters. XHTML vs. HTML is just an implementation detail. I’d much rather see a good XHTML site than a bad HTML one.