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



Hello,

I'm having a problem with the DOM parser:

When the following code is passed through the parser:

<script type="text/_javascript_">
   var d="&quot;Hello world;&quot;";
</script>

it will be converted to:

<script type="text/_javascript_">
   var d=""Hello world"";
</script>

This is because the parser is substituting '&quot;' for  '"'. 

According to w3.org the entities should not be replaced replaces inside CDATA sections, scripts or styles

http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/introduction.html#ID-E7C30824

The same thing applies to html tags inside the <script>:

<script type="text/_javascript_">
   var d="<p>Jack &amp; Jill</p>";
</script>

The "&amp;" should not be replaced by "&"; neither should the <p> or </p> be recognized as a start or close tag

Can this issue be corrected? Is there any way to work around this? 


Best regards,
__
Raymond


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