adding getXMLDoc method that allows creating XML documents with non-HTML compliant nodes (e.g. createCDATASection). r=bartvde (closes #3366)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12108 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-06-18 19:33:29 +00:00
parent 7d477fb8af
commit 2aab742ced
2 changed files with 43 additions and 0 deletions
+13
View File
@@ -849,6 +849,19 @@
}
function test_getXMLDoc(t) {
t.plan(2);
var format = new OpenLayers.Format.XML();
var doc = format.getXMLDoc();
t.ok(doc !== document, "document returned from getXMLDoc is not the page's html doc");
var root = format.createElementNS("http://test", "root");
// appending CDATA created from a different document
var cdata = doc.createCDATASection("<foo></foo>");
root.appendChild(cdata);
var result = format.write(root);
var expect = '<root xmlns="http://test"><![CDATA[<foo></foo>]]></root>';
t.eq(result, expect, "document with CDATA section serialized correctly");
}
</script>