- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Sun, 10 Jul 2005 22:45:50 +1000
- To: WillPower <zorgian@gmail.com>
- CC: www-validator@w3.org
WillPower wrote: > perhaps the validator could ignore script in <javascript></javascript> I assume you mean the <script> element, there is no <javascript> element. And, no the validator *should not* ignore the content of the script element, if it's within the HTML/XHTML document, it *must* be processed according to the rules of SGML for HTML, or XML for XHTML. In HTML, the script element is declared to contain CDATA, which is parsed as ordinary character data up until the first occurance of ETAGO (End-Tag Open) "</". When the ETAGO is encountered, it must be the end-tag for the the script element, which may be either </script> or the widely unsupported, yet valid, SHORTTAG NET (Null End-Tag) </> for the script element. The validator does not understand JavaScript and does not treat the content of the script element as JavaScript. That is why the validator issues errors for script like this: document.write(" ... </a>") However, document.write() should generally be avoided in favour of the more well structured and standardised DOM interface functions that don't work with raw strings of markup like that. See this FAQ entry: http://www.htmlhelp.com/tools/validator/problems.html#script > or maybe you could recommend that the javascript is made into a .js > file and embedded in the html code. That is, of course, the recommended option for all scripts. -- Lachlan Hunt http://lachy.id.au/
Received on Sunday, 10 July 2005 12:46:00 UTC