From e30f267181d990947e67909de4809fa941698c85 Mon Sep 17 00:00:00 2001 From: Chris Schlaeger Date: Sat, 17 Oct 2015 21:36:38 +0200 Subject: Upgrading openlayers to 3.x --- misc/openlayers/tests/Test.AnotherWay.xml_eq.js | 311 ------------------------ 1 file changed, 311 deletions(-) delete mode 100644 misc/openlayers/tests/Test.AnotherWay.xml_eq.js (limited to 'misc/openlayers/tests/Test.AnotherWay.xml_eq.js') diff --git a/misc/openlayers/tests/Test.AnotherWay.xml_eq.js b/misc/openlayers/tests/Test.AnotherWay.xml_eq.js deleted file mode 100644 index 8c24566..0000000 --- a/misc/openlayers/tests/Test.AnotherWay.xml_eq.js +++ /dev/null @@ -1,311 +0,0 @@ -/** - * File: Test.AnotherWay.xml_eq.js - * Adds a xml_eq method to AnotherWay test objects. - * - */ - -(function() { - - /** - * Function: createNode - * Given a string, try to create an XML DOM node. Throws string messages - * on failure. - * - * Parameters: - * text - {String} An XML string. - * - * Returns: - * {DOMElement} An element node. - */ - function createNode(text) { - - var index = text.indexOf('<'); - if(index > 0) { - text = text.substring(index); - } - - var doc; - if(window.ActiveXObject && !this.xmldom) { - doc = new ActiveXObject("Microsoft.XMLDOM"); - try { - doc.loadXML(text); - } catch(err) { - throw "ActiveXObject loadXML failed: " + err; - } - } else if(window.DOMParser) { - try { - doc = new DOMParser().parseFromString(text, 'text/xml'); - } catch(err) { - throw "DOMParser.parseFromString failed"; - } - if(doc.documentElement && doc.documentElement.nodeName == "parsererror") { - throw "DOMParser.parseFromString returned parsererror"; - } - } else { - var req = new XMLHttpRequest(); - req.open("GET", "data:text/xml;charset=utf-8," + - encodeURIComponent(text), false); - if(req.overrideMimeType) { - req.overrideMimeType("text/xml"); - } - req.send(null); - doc = req.responseXML; - } - - var root = doc.documentElement; - if(!root) { - throw "no documentElement"; - } - return root; - } - - /** - * Function assertEqual - * Test two objects for equivalence (based on ==). Throw an exception - * if not equivalent. - * - * Parameters: - * got - {Object} - * expected - {Object} - * msg - {String} The message to be thrown. This message will be appended - * with ": got {got} but expected {expected}" where got and expected are - * replaced with string representations of the above arguments. - */ - function assertEqual(got, expected, msg) { - if(got === undefined) { - got = "undefined"; - } else if (got === null) { - got = "null"; - } - if(expected === undefined) { - expected = "undefined"; - } else if (expected === null) { - expected = "null"; - } - if(got != expected) { - throw msg + ": got '" + got + "' but expected '" + expected + "'"; - } - } - - /** - * Function assertElementNodesEqual - * Test two element nodes for equivalence. Nodes are considered equivalent - * if they are of the same type, have the same name, have the same - * namespace prefix and uri, and if all child nodes are equivalent. - * Throws a message as exception if not equivalent. - * - * Parameters: - * got - {DOMElement} - * expected - {DOMElement} - * options - {Object} Optional object for configuring test options. - * - * Valid options: - * prefix - {Boolean} Compare element and attribute - * prefixes (namespace uri always tested). Default is false. - * includeWhiteSpace - {Boolean} Include whitespace only nodes when - * comparing child nodes. Default is false. - */ - function assertElementNodesEqual(got, expected, options) { - var testPrefix = (options && options.prefix === true); - - // compare types - assertEqual(got.nodeType, expected.nodeType, "Node type mismatch"); - - // compare names - var gotName = testPrefix ? - got.nodeName : got.nodeName.split(":").pop(); - var expName = testPrefix ? - expected.nodeName : expected.nodeName.split(":").pop(); - assertEqual(gotName, expName, "Node name mismatch"); - - // for text nodes compare value - if(got.nodeType == 3) { - assertEqual( - got.nodeValue, expected.nodeValue, "Node value mismatch" - ); - } - // for element type nodes compare namespace, attributes, and children - else if(got.nodeType == 1) { - - // test namespace alias and uri - if(got.prefix || expected.prefix) { - if(testPrefix) { - assertEqual( - got.prefix, expected.prefix, - "Bad prefix for " + got.nodeName - ); - } - } - if(got.namespaceURI || expected.namespaceURI) { - assertEqual( - got.namespaceURI, expected.namespaceURI, - "Bad namespaceURI for " + got.nodeName - ); - } - - // compare attributes - disregard xmlns given namespace handling above - var gotAttrLen = 0; - var gotAttr = {}; - var expAttrLen = 0; - var expAttr = {}; - var ga, ea, gn, en; - for(var i=0; i