Correct syntax conditional comment?

Correct syntax conditional comment?

am 03.12.2007 14:27:20 von Andrew

I have been using the following for some time to call a small css for
anybody still using ie5:



And I have seen countless examples of this exact syntax scattered
around the web. But I am using 4.01 strict so shouldn't I be using:

^^

instead? I suspect not as I have /never/ seen it done this way but I am
curious about the reason.

Andrew
--
"For the God who sings"
http://www.andrews-corner.org/ftgws.html

Re: Correct syntax conditional comment?

am 03.12.2007 14:35:02 von Harlan Messinger

andrew wrote:
> I have been using the following for some time to call a small css for
> anybody still using ie5:
>
>
>
> And I have seen countless examples of this exact syntax scattered
> around the web. But I am using 4.01 strict so shouldn't I be using:
>
> ^^
>
> instead? I suspect not as I have /never/ seen it done this way but I am
> curious about the reason.

Whether or not there's a trailing slash has nothing to do with the
conditional comments. If your page is XHTML, you need the trailing
slash. If it's plain HTML, it shouldn't be there, and if it is, browsers
may still handle your page but beware of lots of issues that have been
discussed here many, many times before.

Re: Correct syntax conditional comment?

am 03.12.2007 14:42:37 von Dylan Parry

Harlan Messinger wrote:

> Whether or not there's a trailing slash has nothing to do with the
> conditional comments. If your page is XHTML, you need the trailing
> slash.

No you don't. It's a comment, so anything within it is simply text as
far as any non-IE browser or parser is concerned, so it makes no
difference whether you use the slash or not.

One could in fact argue that the slash should *never* be used, as the
code within the comment is *only* interpreted by Internet Explorer, and
as IE doesn't support XHTML it makes little sense to include thu
trailing slash in IE-specific code that is actually treated as comment
text by anything else.

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

The opinions stated above are not necessarily representative of
those of my cats. All opinions expressed are entirely your own.

Re: Correct syntax conditional comment?

am 03.12.2007 20:21:26 von dorayme

In article ,
Dylan Parry wrote:

> Harlan Messinger wrote:
>
> > Whether or not there's a trailing slash has nothing to do with the
> > conditional comments. If your page is XHTML, you need the trailing
> > slash.
>
> No you don't. It's a comment, so anything within it is simply text as
> far as any non-IE browser or parser is concerned, so it makes no
> difference whether you use the slash or not.
>
> One could in fact argue that the slash should *never* be used, as the
> code within the comment is *only* interpreted by Internet Explorer, and
> as IE doesn't support XHTML it makes little sense to include thu
> trailing slash in IE-specific code that is actually treated as comment
> text by anything else.

And just in case both answers (by Harlan and Dylan) are not clear
enough, it is simple enough if you think what the conditional is
doing.

Nothing inside the conditional comments is visible to any but IE.
So that settles one question, namely it does not matter what is
there for browsers other than IE, never mind a trailing slash,
you could have a croaking frog in there and they would not know.
And now the question about what you want IE 5 to see. Well, that
is really simple too. What do you want it to see? You would not
want it to see a trailing slash surely, that is not how it is
done in 4.01. not even for IE5!

--
dorayme

Re: Correct syntax conditional comment?

am 03.12.2007 22:52:50 von tabkanDELETETHISnaz

dorayme wrote:

> Nothing inside the conditional comments is visible to any but IE.

Can you provide evidence?
There are hundreds of high and low quality HTML browsers. I doubt that IE
5 is the only to have a buggy comment parser that make it think that