Skip to content

Commit be96646

Browse files
author
Bernhard Kiselka
committed
IE11 can't interpret window.ActiveXObject correctly anymore
As in IE11 it is not possible to use window.ActiveXObject for checking for IE anymore (see http://msdn.microsoft.com/en-us/library/ie/dn423948%28v=vs.85%29.aspx ), it is only possible to use a try-catch instead.
1 parent b7ad987 commit be96646

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/OpenLayers/Format/WPSExecute.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML,
8080
*/
8181
write: function(options) {
8282
var doc;
83-
if (window.ActiveXObject) {
83+
try {
8484
doc = new ActiveXObject("Microsoft.XMLDOM");
8585
this.xmldom = doc;
86-
} else {
86+
} catch(e) {
8787
doc = document.implementation.createDocument("", "", null);
8888
}
8989
var node = this.writeNode("wps:Execute", options, doc);

lib/OpenLayers/Format/XML.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
8181
* the object.
8282
*/
8383
initialize: function(options) {
84-
if(window.ActiveXObject) {
84+
try {
8585
this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
86+
} catch(e) {
8687
}
8788
OpenLayers.Format.prototype.initialize.apply(this, [options]);
8889
// clone the namespace object and set all namespace aliases
@@ -138,7 +139,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
138139
* Since we want to be able to call this method on the prototype
139140
* itself, this.xmldom may not exist even if in IE.
140141
*/
141-
if(window.ActiveXObject && !this.xmldom) {
142+
if (!this.xmldom) {
142143
xmldom = new ActiveXObject("Microsoft.XMLDOM");
143144
} else {
144145
xmldom = this.xmldom;
@@ -871,7 +872,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
871872
if (document.implementation && document.implementation.createDocument) {
872873
OpenLayers.Format.XML.document =
873874
document.implementation.createDocument("", "", null);
874-
} else if (!this.xmldom && window.ActiveXObject) {
875+
} else if (!this.xmldom) {
875876
this.xmldom = new ActiveXObject("Microsoft.XMLDOM");
876877
}
877878
}

0 commit comments

Comments
 (0)