Skip to content

Commit 12fa06f

Browse files
Merge pull request #5 from ubarbaxor/master
🔧 fix issue#4
2 parents 251ada9 + 8670b3a commit 12fa06f

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/parse.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ var utils = require("./utils");
99

1010
var parseXml;
1111

12-
if (typeof window.DOMParser != "undefined") {
13-
parseXml = function(xmlStr) {
14-
return ( new window.DOMParser() ).parseFromString(xmlStr, "text/xml");
15-
};
16-
} else if (typeof window.ActiveXObject != "undefined" &&
17-
new window.ActiveXObject("Microsoft.XMLDOM")) {
18-
parseXml = function(xmlStr) {
19-
var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
20-
xmlDoc.async = "false";
21-
xmlDoc.loadXML(xmlStr);
22-
return xmlDoc;
23-
};
12+
if (typeof window != "undefined" ) {
13+
if (typeof window.DOMParser != "undefined") {
14+
parseXml = function(xmlStr) {
15+
return ( new window.DOMParser() ).parseFromString(xmlStr, "text/xml");
16+
};
17+
} else if (typeof window.ActiveXObject != "undefined" &&
18+
new window.ActiveXObject("Microsoft.XMLDOM")) {
19+
parseXml = function(xmlStr) {
20+
var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
21+
xmlDoc.async = "false";
22+
xmlDoc.loadXML(xmlStr);
23+
return xmlDoc;
24+
};
25+
}
2426
}
25-
2627
/**
2728
* @private
2829
* @global
@@ -116,7 +117,7 @@ function callParseFunctions(tagName, node, options) {
116117
}
117118

118119
/**
119-
* Parses a (EO-)WCS response to JavaScript objects.
120+
* Parses a (EO-)WCS response to JavaScript objects.
120121
*
121122
* @param xml the XML string to be parsed
122123
* @param options options for parsing

0 commit comments

Comments
 (0)