[Javascript] Decrement operator, XHTML Strict 1.1 DTD, Internet Explorer 6?

David Dorward david at dorward.me.uk
Sat Jul 29 16:14:47 CDT 2006


On Sat, Jul 29, 2006 at 05:06:02PM -0400, John Warner wrote:

>    Target browser is IE 6 (Winders)

>    This is for my own education, how do you handle this? I was trying to use
>    the XHTML 1.1 Strict DTD. 

There is no such DTD, at least not published by the W3C.

XHTML 1.0 has a Strict varient.
XHTML 1.1 is just XHTML 1.1.

Incidently, the provision for serving XHTML as text/html does not
apply to XHTML 1.1 - so (unless you violate the standard) Internet
Explorer will prompt the user to open the document in another
application or to save it.

>    With my script code in the document head, I have a function that
>    has a line of code: --counter //decrement counter The code works
>    this way just fine in IE. But when I went to the w3c validator it
>    fails me due to this line within my script; calls it an
>    improperly formed comment.

That's odd. You aren't starting your script with <!-- are you? That is
a pretty nasty hack in HTML and a real comment in XHTML (since XHTML
doesn't have implicit CDATA like HTML).

>    OK, I think and proceed to enclose my script code within a CDATA
>    block. W3C validator says OK, script blows up in IE - wait for
>    it, guess where, on the CData opener and closer.

Inline script in XHTML that may be served as HTML with a right pain in
the whatsit. 

http://hixie.ch/advocacy/xhtml

You are usually better off using external script files (for that
matter, sticking to HTML 4.01 on the client side is almost always the
best option[1]).


[1] The benefits of XHTML on the client don't apply unless you serve
it as XHTML, and if you serve it as XHTML then lots of user agents
(including, at last count, Internet Explorer, Lynx and GoogleBot)
won't do anything useful with the document at all.

-- 
David Dorward                                      http://dorward.me.uk




More information about the Javascript mailing list