RE: [PEAR-DEV] QF: Javascript sections not XHTML compliant?
| From: | Dave Mertens | Date: | Wed, 22 Oct 2003 14:10:12 +0000 |
| Subject: | RE: [PEAR-DEV] QF: Javascript sections not XHTML compliant? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22908@lists.php.net to get a copy of this message | ||
> Should PEAR CS not require that JS sections - or for that matter all HTML
> output - be XHTML-strict compliant? (didn't see anything to this
> effect in
> the doc)
> eg:
> <script type="text/javascript">
> //<![CDATA[
> ...
> //]]>
> </script>
>
> instead of the usual
> <script type="text/javascript">
> <!--
> ...
> // -->
> </script>
> which AFAI is not XHTML compliant
> (Comments (<!-- ... -->) must not contain double dashes (--) )
> therefore statements such as --x will cause non-conformance
>
NO! When you use CDATA in a HTML 4.01 document, it will not be validated as strict anymore.
So, the javascript component should have a extra option to set this property.
In a same way <link type="text/javascript" href="../scripts/menu.js"
rel="javascript" /> is not allowed in 4.01 strict. Browsers don't have a problem
when you close empty html elements, but it's not conform the HTML standard..
To prevents such error on websites i'm working on, i simply use the link element. It is valid
in both html and xhtml documents and the only difference is the closing slash for the empty link
element.
I don't use transitional DTD with my site, i use always the struct DTD. And most xhtml is
transformed into HTML using XSLT. Depending on the browser html or xhtml is sent to the browser.
But that is just me ;-)
Regards,
Dave