Re: Weather Report: Request for Appraisal

> 2. In XHTML documents, style and script content should not be in a comment
> because it technically means that the browser will see it as a comment and

Must not, not should not.

> not as actual style or script content (though browsers are currently
> forgiving about this). However, not using comments makes your document less

If the document is served as XHTML, rather than broken HTML (i.e. has
an HTTP header indicating that it is XHTML), the browser must honour
the comments and ignore the contents.  Almost certainly the reason that
the invalid XHTML is working is that it is being sent as HTML and
is therefore being processed under HTML error recovery rules, not as
XHTML.

Note that IE does not support XHTML, so one really should not
use XHTML on web sites for the general public.  You can, of course,
include all the optional opening and closing tags in HTML documents, so
that aspect of XHTML isn't a justification for sending it for general
consumption.  If necessary, you can use an XHTML master, and transform
before sending to legacy browsers.

Incdentally, DTD based validators will not fault XHTML with commented
out style and script elements.

Received on Wednesday, 15 September 2004 06:49:34 UTC