Re: [xml] DOM parser and HTML entities inside the <script> tag

Raymond Irving schrieb am 18.07.2012 um 23:20 (-0500):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "";>
<html><head><script type="text/javascript">
   var d="&quot;Hello world;&quot; &lt;Test&gt; &amp; ";
   var h="<p>Some other text</p>";

I get the following result:

script.html:4: HTML parser error : Unexpected end tag : p
   var h="<p>Some other text</p>";

IMO, I don't think the parser should be parsing content within the
<script> tag

I think the following applies:

  Although the STYLE and SCRIPT elements use CDATA for their data
  model, for these elements, CDATA must be handled differently by
  user agents. Markup and entities must be treated as raw text and
  passed to the application as is. The first occurrence of the
  character sequence "</" (end-tag open delimiter) is treated as
  terminating the end of the element's content. In valid
  documents, this would be the end tag for the element.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]