Re: Bizarre <script> tag spec

jwp@checfs1.ucsd.edu wrote:
> thus, this is illegal:
> 
>     >      <SCRIPT type="text/javascript">
>     >        document.write ("<EM>This won't work</EM>")
>     >      </SCRIPT>
> 
>     > A conforming parser must treat the "</EM>" data as the end of
>     > script data, which is clearly not what the author intended.
> 
> Quite frankly, this seems to be exceptionally dumb. Was there a
> sensible reason for this decision?

The arcane rules of SGML, the sensibility of which is beyond the scope
of this forum. The pertinent strictures have been incised on the
standing stones of the ISO, and will remain unchanged til the end of
time.

You can 'legalize' JavaScript by splitting a string:

  document.write ("<EM>This will work<"+"/EM>")

or escaping the slash:

  document.write ("<EM>This will work<\/EM>")

The 'big two' browsers aren't strict about this, and I'm quite sure
most authors haven't a clue.

David Perrell

Received on Monday, 14 July 1997 03:21:14 UTC