XML Serialization doesn't wrap nodes in documents. This breaks or changes
serialization in some browsers. This fixes the XML Format based tests in Safari. (Closes #1218) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5487 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -110,7 +110,15 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
|
|||||||
data = node.xml;
|
data = node.xml;
|
||||||
} else {
|
} else {
|
||||||
var serializer = new XMLSerializer();
|
var serializer = new XMLSerializer();
|
||||||
data = serializer.serializeToString(node);
|
if (node.nodeType == 1) {
|
||||||
|
// Add nodes to a document before serializing. Everything else
|
||||||
|
// is serialized as is. This may need more work. See #1218 .
|
||||||
|
var doc = document.implementation.createDocument("", "", null);
|
||||||
|
doc.appendChild(node);
|
||||||
|
data = serializer.serializeToString(doc);
|
||||||
|
} else {
|
||||||
|
data = serializer.serializeToString(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user