IE10, 11 CDATA with hyphens parsed incorrectly

I had this problem: when I try to parse the xml I get from the server, the messages contained in the CDATA blocks are parsed in IE10, 11 until the first hyphens are detected.

See the XML example that I received:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<response>
    <task>results</task>
    <finish_msg><![CDATA[
      <div class="jq_results_container_outer">
        <div class="jq-msg-alert-0">
        </div>
      </div><br />]]>
   </finish_msg>
</response>

And when I called such Javascript code in IE 10, 11 var data = response.getElementsByTagName('finish_msg')[0].firstChild.data I get dataequal<div class="jq_results_container_outer"><div class="jq

Everything works for FF, Chrome, Opera, IE 8, 9. Thanks

+4
source share
1 answer

Look at this error message in IE11:

https://connect.microsoft.com/IE/feedback/details/1398926/ie11-does-not-parse-cdata-containing-hyphens-correctly

, ​​ Edge IE11 (11.0.10240.16431), IE11.

​​:

new DOMParser().parseFromString('<tag><![CDATA[data-with-hyphen]]></tag>', 'text/xml').firstChild.firstChild.nodeValue;

, .

: :

response.getElementsByTagName('finish_msg')[0].textContent
+2

Source: https://habr.com/ru/post/1528945/


All Articles