A
Andy Fish
hi,
this is more an html parsing question than an XML question but I think it's
the kind of thing that folks in an XML newsgroup would be more likely to
help with, so please excuse me if it's a little off topic. please be aware
that I am primarily talking about HTML rather than XHTML but I would also
like to understand how XHTML works for when I prepare to convert the app to
XHTML.
I have recently discovered that this:
<script>var x='</script>';</script>
is not valid HTML - the fact that there is an end script tag in quotes
causes the parser to stop recognising the script. initially my reaction was
that this is not a surprise because I had failed to HTML encode the script
contents, so my second attempt was this:
<script>var x='</script>';</script>
however this it DOES NOT WORK - the variable ends up containing the text
"</script>"
can someone point me at part of the w3c specification that states how script
tags are parsed differently to other tags in HTML.
interestingly i have also discovered that this:
<script>if (3<5);</script>
IS valid html and seems even to be valid XHTML even though it is not valid
XML
Andy
this is more an html parsing question than an XML question but I think it's
the kind of thing that folks in an XML newsgroup would be more likely to
help with, so please excuse me if it's a little off topic. please be aware
that I am primarily talking about HTML rather than XHTML but I would also
like to understand how XHTML works for when I prepare to convert the app to
XHTML.
I have recently discovered that this:
<script>var x='</script>';</script>
is not valid HTML - the fact that there is an end script tag in quotes
causes the parser to stop recognising the script. initially my reaction was
that this is not a surprise because I had failed to HTML encode the script
contents, so my second attempt was this:
<script>var x='</script>';</script>
however this it DOES NOT WORK - the variable ends up containing the text
"</script>"
can someone point me at part of the w3c specification that states how script
tags are parsed differently to other tags in HTML.
interestingly i have also discovered that this:
<script>if (3<5);</script>
IS valid html and seems even to be valid XHTML even though it is not valid
XML
Andy