[thelist] Javascript/XHTML Strict Validation

Andrew Clover and-evolt at doxdesk.com
Tue Nov 9 14:02:02 CST 2004


Timothy Joko-Veltman <tim at indigopixel.com> wrote:

> for (var i=0; i &lt; sfEls.length; i++) { 

> Yes, it looks like it'll generate an error, but it doesn't ... 

Only when the file is loaded by a true XML parser, for example in 
Mozilla if it is served as application/xhtml+xml or loaded from disc 
with an .xhtml extension.

Otherwise, in legacy-HTML, the <script> element is defined as containing 
CDATA, so '&lt;' will not get turned into '<' and there will indeed be 
an error.

The lame workaround is of course:

   for (var i= 0; sfEls.length>i; i++) {

But yeah, external JS is much better for most coding purposes.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/


More information about the thelist mailing list