okay, i've been trying to figure out which doctype i should be using ... i think up until now i've been using transitional ... and i guess stuff has been working out fine. but i'm trying to learn more and the amount of crap on the subject is overwhelming. i don't want to read for 5 hours to understand this ... anyone who has a good handle on this can give me the lowdown?
i have seen this (and many others): alistapart.com/stories/doctype/
it lists them, but doesn't guide me towards which one i really should be using ...
any thoughts, opinions, stories?
WingNut 2008.05.02, 12:14AM — Doctypes explained
OvineWorrier 2008.05.02, 12:28AM —
This could end up sort a Mac vs PC.
There's only two you need to think about:
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
and
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Bear in mind, if you go the XHTML route, learn it well. quickstart.
WingNut 2008.05.02, 06:13PM —
thanks, i appreciate it.
----
(i can hear my cat throwing up in the other room)
JERKSTORE 2008.05.05, 02:24PM —
I use XHTML transitional for almost everything:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
tenPlus 2008.05.05, 08:27PM —
Originally posted by: OvineWorrier
transitional = pointless.
Go strict, mofo!
why?
OvineWorrier 2008.05.05, 11:02PM —
Originally posted by: tenPlusOriginally posted by: OvineWorrier
transitional = pointless.
Go strict, mofo!
why?
Because it'll get you groupies.
Not good enough?

Okay, I'll clarify:
transitional = pointless for new websites.
The plan was for it to be used as a stop-gap for websites where html was "transitioned" from the old, horrible tag soup mess to the new separation of structure and presentation hotness. The latter being served by CSS (and I suppose some Javascript for those times IE6/5.5 doesn't want to play along).
For new websites, you should really pick your flavour, HTML or XHTML, and follow the rules. If the live site is going to be updated by non-savvy clients, or accepts user comments, use server-side scripting to clean up the HTML.
Browsers will have a go at rendering pretty much anything you throw at them and, in the interests of backwards compatibility with the older internet, can chew their way through some nasty stuff although this results in a slight rendering delay while the browser chews through and parses the file. Why not send it valid, strict HTML and bog down your page rendering times with Web 2.0 javascript sexiness instead?
Most importantly though, are the groupies.

the real me 2008.05.06, 03:17PM —
i think my biggest problem with strict is not allowing the target attribute on links. and no iframes is a pain sometimes even though i try to avoid them.
OvineWorrier 2008.05.08, 01:33AM —
Originally posted by: the real me
i think my biggest problem with strict is not allowing the target attribute on links. and no iframes is a pain sometimes even though i try to avoid them.
Target attributes on links could be added post-load by javascript.
The <object> tag can be used instead of iframes. There's issues with IE6 which can be massaged into place, again with some scripting. I used to have an excellent article bookmarked about this but I'm getting a 404. (which would have mentioned other caveats I'm forgetting at the mo) I'll do a google once my head's cleared. Though I must admint, I've never tried it out as a replacement for the iframe fallback when doing ajaxy stuff.

tenPlus 2008.05.09, 08:30PM —
Originally posted by: WingNut
this is good info, thanks for the discussion
the real me 2008.05.09, 09:06PM —
Originally posted by: OvineWorrier
Target attributes on links could be added post-load by javascript.
but then you are to the point of just validating for the sake of saying it's valid, and the groupies. it has no real meaning. what the browser ultimately sees is still not technically valid code if you are adding targets with javascript. you are basically just fooling the validator.
OvineWorrier 2008.05.10, 05:38PM —
Not quite
(though I agree with your point)
Those were just two possible solutions to the examples you provided.
Target attributes on links are pretty pointless given that all the major browsers have tabbed interfaces and, for example in FF, a middle click on a link opens a new tab. There's also the boring argument about "breaking the back button". On the other hand, it can be a bit of a battle if the client is adamant that users shouldn't leave their website to look at an external link. (my counter-argument of tabs or users knowing how to open a link in a new window usually works.)
Using Javascript to inject attributes or additional HTML - for example, adding a hidden iframe - into a page is one way of at least ensuring the underlying HTML document stays valid. Anyways, as I said previously, modern browsers can handle it. Legacy browsers get the vanilla HTML.
I concede that my opinion on Transitional Doctypes is based on projects (past and ongoing) where the HTML document is not just used for browsers. For example, parsing HTML to generate a PDF or vice-versa. Over time, I've found it's less hassle just to have a Strict Doctype and then use css/javascript to massage things.
JERKSTORE 2008.05.12, 12:46AM —
OW is totally right, btw. Transitional is pointless. I just never seem to want to worry about dealing with Strict when I start a new project, so I stick with transitional. It's because I'm lazy, not because transitional is better than strict.
Since I've never spent much time mucking with strict, I'm not totally familiar with it's target issues on an anchor. I'm assuming this is mostly an issue for people wanting to use _blank, since anybody using frames these days probably isn't interested in using a strict doctype.
Again, because I'm lazy, I don't have the desire to build a little test page and actually see if it validates, but it seems like this should work to duplicate target="_blank" without the target:
<a href="http://www.url.com" onclick="javascript:open.window(this.href);return true;">
I'm like 200% anti using javascript to FIX things in the browser. I'm all for using it to extend functionality (ajax, etc) but it give me the heeby jeebies thinking about using some javascript to alter a page layout to look right in a certain browser or something. Yuck!
WingNut 2008.05.13, 08:29PM —
i think my biggest problem with strict is not allowing the target attribute on links.
i'm not sure i'm following what the issue is ... does using strict mean that you can't use _blank for a target to open a website in a new window/tab??
i just worked up a test page:
HOT XXX SQUID PORN
anybody care to comment ... it's html strict ... i guess i'm not seeing the issue
the only thing i really notice is that ie wants to open it in a new window and ff wants to open it in a new tab (although this may be due to a setting in ff, i don't remember if that was the default or not)
this page seems to validate?
gah. what am i not getting
OvineWorrier 2008.05.13, 08:58PM —
Doesn't validate for me:
linkage
and god do I hate myself for typing that. It's like one of those smug standardistas who upon being presented with some stunning design will whack up the "yes. very pretty but it doesn't validate *smug preachy zeldman book arsebagge* post. probably has it as a shortcut. Ewww.
But you asked. 
And now I must shower.
WingNut 2008.05.13, 09:06PM —
hm. weird. why doesn't my developer bar in ff show that? it shows it as validating.
so i guess this makes the point that strict doesn't all for target attributes, which is what you were saying.
is it me or is that kind of retarded?
i have to run out to a meeting, but i'm looking forward to going back and looking over the validation in more detail
... again, good conversation, i'm learning some stuff i did not know. thanks for that.
Blaise 2008.05.14, 10:31AM —
I guess the argument here is that the HTML should only control the data, opening a window in a new window is considered part of the functional layer, or behaviour layer. Thus JavaScript should control anything in these layers.
This goes despite that fact that you probably shouldn't be opening anything in a new window anyway 
WingNut 2008.05.14, 04:58PM —
okay, so i went in and cleaned up that little test page and got it to validate properly
in order to do so, i had to remove any target attributes in an <a href .. , i had to wrap everything in a div and i also had to include the following line in the < head > tag:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
so in order to make something strict, no opening new windows or tabs in simple html is 'allowed'
>>>>>is the logic in this that the user should know to control click something in order to open it in a new tab?<<<<<
and if i don't think that the visitors to the site i'm building will know this intuitively and i want to have a link that opens a new window, i should use javascript:
<a href="http://www.google.com" onclick="javascript:window.open(this.getAttribute('href'), '_blank');return false;">javascript new window</a>
