doctype conditionals

doctype conditionals

am 19.07.2007 03:50:38 von osmanjaro

Hi all,
On a recent experiment with getting ie6 to work I did something that
feels wrong, but works.
I know conditional comments work well for loading stylesheets and
javascript.
Why not doctypes? Its only ie6 that gets the transitional doctype,
everyone else gets strict.




"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">



....

I'm sure this is bad. IE6 made me do it.
What do people here think about this?
--
i

Re: doctype conditionals

am 19.07.2007 04:03:54 von Bergamot

osmanjaro wrote:
> I know conditional comments work well for loading stylesheets and
> javascript.
> Why not doctypes? Its only ie6 that gets the transitional doctype,

FYI, anything before the DOCTYPE automatically triggers quirks mode in IE6.

> I'm sure this is bad. IE6 made me do it.

Yes it is a bad practice. Post a URL that shows why you think this is
the solution to whatever problem you think you have.

IOW, you may be fixing the wrong problem.

--
Berg

Re: doctype conditionals

am 19.07.2007 12:48:59 von jkorpela

Scripsit osmanjaro:

> On a recent experiment with getting ie6 to work I did something that
> feels wrong, but works.

For some odd value of "works", I suppose.

> I know conditional comments work well for loading stylesheets and
> javascript.

Browser-specific tricks for IE "work" for some versions of IE.

> Why not doctypes?

Why would you play such a game? There's a lot you can lose, but is there
anything you could win?

> Its only ie6 that gets the transitional doctype,
> everyone else gets strict.

The point being? IE does not understand document type definitions any more
than pigs appreciate silver plates (excuses to our porcine friends for this
somewhat unfair metaphor). It only looks at the doctype string to make its
foolish choice between Quirks and "Standards" (i.e., less broken) rendering
mode. Here it does not matter whether it's Strict or Transitional, as long
as you use the exact string specified in HTML specifications.

>
>
>
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
>
>
> ...
>
> I'm sure this is bad.

So why do you use it?

> IE6 made me do it.

Even the &Devil; should not be accused for something that he clearly did not
do.

Using HTML 4.01 and XHTML 1.0 as "conditional" alternatives is just madness.
Using XHTML 1.0 is pointless on the web, so you have really messed things
up.

If you just want IE 6 to go to Quirks mode and other doctype sniffers to go
to "Standards" mode, use just the following, followed by a doctype
declaration that corresponds to the actual markup you have used:



Try it. It works. (Someone will probably soon send a spoiler that reveals
_why_ it works, so try it _now_.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Re: doctype conditionals

am 20.07.2007 14:36:20 von Toby A Inkster

Jukka K. Korpela wrote:

> If you just want IE 6 to go to Quirks mode and other doctype sniffers to go
> to "Standards" mode, use just the following, followed by a doctype
> declaration that corresponds to the actual markup you have used:
>
>
>
> Try it. It works. (Someone will probably soon send a spoiler that reveals
> _why_ it works, so try it _now_.)

I was about to recommend something similar.

Spoiler (ROT13): nal pbzzragf orsber gur QBPGLCR guebj VR vagb dhvexf zbqr.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 29 days, 16:14.]

Parsing an HTML Table with PEAR's XML_HTTPSax3
http://tobyinkster.co.uk/blog/2007/07/20/html-table-parsing/

Re: doctype conditionals

am 22.07.2007 13:46:44 von osmanjaro

Thanks Berg, Jukka and Toby, I was only experimenting with a fixed div
layout.
http://www.chameleonmoments.com/2/tst.html
I won't use this hack, but was curious enough to ask here about it.
It would be nice to know a way that doesn't break anything important
(like positioning or doctype).

It's funny that people do things they would never do to fix the
problem on the surface, only to make it worse underneath. HTML
imitates life.

I didn't know about triggering quirks mode, never needed to do it, but
I learned something.
The amazing Jukka command... to have your own ie hack, you must truly
be an html master.

cheers
--
i

Re: doctype conditionals

am 22.07.2007 18:03:24 von Neredbojias

Well bust mah britches and call me cheeky, on Sun, 22 Jul 2007 11:46:44 GMT
osmanjaro scribed:

> Thanks Berg, Jukka and Toby, I was only experimenting with a fixed div
> layout.
> http://www.chameleonmoments.com/2/tst.html
> I won't use this hack, but was curious enough to ask here about it.
> It would be nice to know a way that doesn't break anything important
> (like positioning or doctype).
>
> It's funny that people do things they would never do to fix the
> problem on the surface, only to make it worse underneath. HTML
> imitates life.
>
> I didn't know about triggering quirks mode, never needed to do it, but
> I learned something.
> The amazing Jukka command... to have your own ie hack, you must truly
> be an html master.

Jukka is, indeed, a master. He's also quite a debator. You put the two
together, and, well...

--
Neredbojias
Half lies are worth twice as much as whole lies.