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

Thanks for the feedback Micheal.

I thought that the first occurrence of </script or </style would be signal the end of the element's content but I guess the W3C had something else in mind.

Best regards,

On Fri, Jul 20, 2012 at 4:01 AM, Michael Ludwig <milu71 gmx de> wrote:
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>";
> </script></head></html>
> 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.


xml mailing list, project page
xml gnome org

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