Internet Explorer XML Browser Invalid hypens translation and cannot reproduce example

I am debugging the following code of a larger system that is not written by me. There is XML coming from the server through AJAX that is not being processed properly. The problem is explained below.

Please note that the hyphen - Internet Explorer inserts them, if there is one in the CDATA part.

enter image description here

When I print, for example,

console.log(a.item(4).childNodes.item(0));

I get

`{"INCD":"30362790021","sycd":"BKJ2` 

To debug the problem, I am trying to create a minimal example.

I copied the variable source(setting a breakpoint with the condition .ocmmand == 'List_detail') into a simple Javascript HTML file as follows:

<script>

    var source = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE primrose SYSTEM \"dtd/primrose.dtd\">\n<primrose><array type=\"string\"> .... </primrose>";

    var xml = new DOMParser().parseFromString(source, 'text/xml');
    var a = xml.documentElement.childNodes;
    console.log(a);
    console.log(a.item(4).childNodes.item(0));
</script>

An example in its entirety - http://pastebin.com/GaHdjiWW

But this seems very good:

enter image description here

When I run console.log(a.item(4).childNodes.item(0));, I get

{"INCD":"30362790021","sycd":"BKJ2-2","type_code":"00000050555","type_name":"BKJ","series_code":"110302280810","web_product_id":"10302280810","series_name":"Cross Recessed Pan Head Screws","disp_brandName":"MISUMI","brd_code":"MSM1","ecal_brd_code":"MSM","main_photo":"MSM1/PHOTO/10302280810.jpg","catch_copy":null,"cad_2d":"1","cad_2d_type":"1","cad_3d":"1","cad_3d_type":"2","scene7_img_product":[{"img_fileName":"110302280810_20149999_m_01_99999_jp","img_description":""}],"ary_displayLink":null,"ary_param_verify":"BKJ{2}\t{2}","ary_param_disp":"BKJ{2}\t{2}","param_conv_bef":null,"param_conv_bef_disp":null,"canOrder":"1"}

etc.

Internet Explorer - 11.0.9600.18314

IE10, 11 CDATA , - ​​IE. ?

+4
2

MutationObserver.observe childList : https://github.com/talee/mutationobserver-breaks-characterdata. : MutationEvents IE < . https://www.npmjs.com/package/mutationobserver-polyfill IE 11.

:

var observer = new MutationObserver(function() {});
// Other mutation types/combos work fine
observer.observe(document, {
  childList: true,
  subtree: true
});

:

var parser = new DOMParser();
var expectedContent = 'hello-world';
// <div>hello-world</div> breaks too. Using CDATA as that my current use
// case.
var xml = parser.parseFromString('<div><![CDATA[' + expectedContent + ']]></div>','text/xml');
var result = xml.firstChild.firstChild.data;

// Output test results for viewing
if (result != expectedContent) {
  statusOut.textContent = 'FAIL';
} else {
  statusOut.textContent = 'SUCCESS';
}
resultOut.textContent = 'Result: "' + result + '"';

IE 11 https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8589859/.

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

Brad [MSFT] 17.02.2012 12:02

. . IE 11.29.10586.0. , IE, . . Edge.

+3

All Articles