diegoles / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

goog.dom.xml is broken on MSIE9 #456

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1. var doc = goog.dom.xml.loadXml('<a><b><c>d</c></b></a>');
2. var aNode = doc.firstChild;
3. goog.dom.xml.selectSingleNode(aNode, 'b');

What is the expected output? What do you see instead?

Expected return value is a node element (b node). Instead, it returns null.

What version of the product are you using? On what operating system?

closure-library from trunk. Windows 7 using MSIE9.

Please provide any additional information below.

IE9 dom Element does not support selectSingleNode neither xpath.
So, if you creating an xml document using IE9 DOMParser or 
document.implementation.createDocument.

On IE9, goog.dom.xml.createDocument uses document.implementation.createDocument 
to create an xml document. It should use goog.dom.xml.createMsXmlDocument_ 
instead (method used by IE6, IE7 and IE8).

On IE9, goog.dom.xml.loadXml uses DOMParser to load xml and create an xml 
document. It should use goog.dom.xml.createMsXmlDocument_ instead (method used 
by IE6, IE7 and IE8).

Attachment is a patch containing a fix. Please apply it from trunk root using :
patch -p0 -i goog.dom.xml.patch

Original issue reported on code.google.com by vincent.alquier on 24 Apr 2012 at 12:10

GoogleCodeExporter commented 8 years ago
Sorry for incomplete sentence :
So, if you create an xml document using IE9 DOMParser or 
document.implementation.createDocument, you can't select nodes using 
goog.dom.xml.selectSingleNode or goog.dom.xml.selectNodes.

Problem is, on IE9, goog.dom.xml.createDocument uses 
document.implementation.createDocument, and goog.dom.xml.loadXml uses DOMParser.

Original comment by vincent.alquier on 24 Apr 2012 at 12:13

GoogleCodeExporter commented 8 years ago
IE9's XMLSerializer can't serialize MSXML2.DOMDocument object.
So, goog.dom.xml.serialize should use xml.xml instead (already used by IE6, IE7 
and IE8).

A new patch as attachment...

Original comment by vincent.alquier on 24 Apr 2012 at 1:41

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for your patch!

It helps me a lot.

Original comment by kxzkxz7...@gmail.com on 22 Sep 2013 at 7:07