Merge pull request #734 from bartvde/xml-ie9

Fix XML serialize and xml_eql in IE9 (r=@ahocevar)
This commit is contained in:
Bart van den Eijnden
2013-05-27 02:28:48 -07:00
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -256,7 +256,9 @@ ol.parser.XML.prototype.setAttributeNS = function(node, uri, name, value) {
* @return {string} The serialized XML string. * @return {string} The serialized XML string.
*/ */
ol.parser.XML.prototype.serialize = function(node) { ol.parser.XML.prototype.serialize = function(node) {
if (node.nodeType == 1) { if (this.xmldom) {
return node.xml;
} else if (node.nodeType == 1) {
// Add nodes to a document before serializing. Everything else // Add nodes to a document before serializing. Everything else
// is serialized as is. This is also needed to get all namespaces // is serialized as is. This is also needed to get all namespaces
// defined in some browsers such as Chrome (xmlns attributes). // defined in some browsers such as Chrome (xmlns attributes).
+4 -1
View File
@@ -318,7 +318,10 @@
} }
// test attribute namespace // test attribute namespace
try { try {
expect(node1Attr[name].namespaceURI).to.equal(node2Attr[name].namespaceURI); // we do not care about the difference between an empty string and null for namespaceURI
// some tests will fail in IE9 otherwise
// see also http://msdn.microsoft.com/en-us/library/ff460650(v=vs.85).aspx
expect(node1Attr[name].namespaceURI || null).to.be(node2Attr[name].namespaceURI || null);
} catch(e) { } catch(e) {
errors.push('namespaceURI attribute test failed for: ' + node1.nodeName + ' | ' + e.message); errors.push('namespaceURI attribute test failed for: ' + node1.nodeName + ' | ' + e.message);
} }