projects
/
mkws-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reinstate "Related Topics" widget.
[mkws-moved-to-github.git]
/
test
/
spec-dev
/
parseXML.js
diff --git
a/test/spec-dev/parseXML.js
b/test/spec-dev/parseXML.js
index
c1eb474
..
ec37219
100644
(file)
--- a/
test/spec-dev/parseXML.js
+++ b/
test/spec-dev/parseXML.js
@@
-1,24
+1,24
@@
// Workaround for broken XML parser in node.js/jquery
// Workaround for broken XML parser in node.js/jquery
-
+// see https://github.com/coolaj86/node-jquery/issues/29
var jsdom = require("jsdom");
var DOMParser = require('xmldom').DOMParser;
var jsdom = require("jsdom");
var DOMParser = require('xmldom').DOMParser;
-var xmlstring = '<?xml version="1.0" encoding="UTF-8"?><process>yes</process>';
+var xmlstring = '<?xml version="1.0" encoding="UTF-8"?><process>yes</process>';
-jsdom.env(
- '<html/>',
- // ["http://code.jquery.com/jquery.js"],
- function (errors, window) {
- // var $ = window.$;
- var $ = require('jQuery');
+jsdom.env('<html/>',
+// ["http://code.jquery.com/jquery.js"],
- // override jquery xml parser with external XML lib xmldoc.DOMParser
- $.parseXML = function(data) { return new DOMParser().parseFromString(data) };;
+function (errors, window) {
+ // var $ = window.$;
+ var $ = require('jQuery');
- // parse XML string, extract "process" node and keep the text value of the node
- var result = $( $.parseXML(xmlstring)).find("process").text();
+ // override jquery xml parser with external XML lib xmldoc.DOMParser
+ $.parseXML = function (data) {
+ return new DOMParser().parseFromString(data)
+ };;
- // should output "yes"
- console.log("Testing jsdom/xmldom/jQuery $.parseXML() support: " + result);
- }
-);
+ // parse XML string, extract "process" node and keep the text value of the node
+ var result = $($.parseXML(xmlstring)).find("process").text();
+ // should output "yes"
+ console.log("Testing jsdom/xmldom/jQuery $.parseXML() support: " + result);
+});