From be96646eca83e99f8af9784618f2d282e72138e7 Mon Sep 17 00:00:00 2001 From: Bernhard Kiselka Date: Tue, 25 Mar 2014 19:42:10 +0100 Subject: [PATCH 1/9] 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. --- lib/OpenLayers/Format/WPSExecute.js | 4 ++-- lib/OpenLayers/Format/XML.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/OpenLayers/Format/WPSExecute.js b/lib/OpenLayers/Format/WPSExecute.js index 0795b0d180..a23ce3906d 100644 --- a/lib/OpenLayers/Format/WPSExecute.js +++ b/lib/OpenLayers/Format/WPSExecute.js @@ -80,10 +80,10 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, */ write: function(options) { var doc; - if (window.ActiveXObject) { + try { doc = new ActiveXObject("Microsoft.XMLDOM"); this.xmldom = doc; - } else { + } catch(e) { doc = document.implementation.createDocument("", "", null); } var node = this.writeNode("wps:Execute", options, doc); diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js index b3f60ce979..235c051c7a 100644 --- a/lib/OpenLayers/Format/XML.js +++ b/lib/OpenLayers/Format/XML.js @@ -81,8 +81,9 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { * the object. */ initialize: function(options) { - if(window.ActiveXObject) { + try { this.xmldom = new ActiveXObject("Microsoft.XMLDOM"); + } catch(e) { } OpenLayers.Format.prototype.initialize.apply(this, [options]); // clone the namespace object and set all namespace aliases @@ -138,7 +139,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { * Since we want to be able to call this method on the prototype * itself, this.xmldom may not exist even if in IE. */ - if(window.ActiveXObject && !this.xmldom) { + if (!this.xmldom) { xmldom = new ActiveXObject("Microsoft.XMLDOM"); } else { xmldom = this.xmldom; @@ -871,7 +872,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { if (document.implementation && document.implementation.createDocument) { OpenLayers.Format.XML.document = document.implementation.createDocument("", "", null); - } else if (!this.xmldom && window.ActiveXObject) { + } else if (!this.xmldom) { this.xmldom = new ActiveXObject("Microsoft.XMLDOM"); } } From 2661b83b2645d3e834bf61919478697531c25b74 Mon Sep 17 00:00:00 2001 From: Bernhard Kiselka Date: Tue, 25 Mar 2014 19:50:18 +0100 Subject: [PATCH 2/9] 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. --- lib/OpenLayers/Format/WPSExecute.js | 4 ++-- lib/OpenLayers/Format/XML.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/OpenLayers/Format/WPSExecute.js b/lib/OpenLayers/Format/WPSExecute.js index 0795b0d180..a23ce3906d 100644 --- a/lib/OpenLayers/Format/WPSExecute.js +++ b/lib/OpenLayers/Format/WPSExecute.js @@ -80,10 +80,10 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, */ write: function(options) { var doc; - if (window.ActiveXObject) { + try { doc = new ActiveXObject("Microsoft.XMLDOM"); this.xmldom = doc; - } else { + } catch(e) { doc = document.implementation.createDocument("", "", null); } var node = this.writeNode("wps:Execute", options, doc); diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js index b3f60ce979..235c051c7a 100644 --- a/lib/OpenLayers/Format/XML.js +++ b/lib/OpenLayers/Format/XML.js @@ -81,8 +81,9 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { * the object. */ initialize: function(options) { - if(window.ActiveXObject) { + try { this.xmldom = new ActiveXObject("Microsoft.XMLDOM"); + } catch(e) { } OpenLayers.Format.prototype.initialize.apply(this, [options]); // clone the namespace object and set all namespace aliases @@ -138,7 +139,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { * Since we want to be able to call this method on the prototype * itself, this.xmldom may not exist even if in IE. */ - if(window.ActiveXObject && !this.xmldom) { + if (!this.xmldom) { xmldom = new ActiveXObject("Microsoft.XMLDOM"); } else { xmldom = this.xmldom; @@ -871,7 +872,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { if (document.implementation && document.implementation.createDocument) { OpenLayers.Format.XML.document = document.implementation.createDocument("", "", null); - } else if (!this.xmldom && window.ActiveXObject) { + } else if (!this.xmldom) { this.xmldom = new ActiveXObject("Microsoft.XMLDOM"); } } From f0ce41c0aef69de87ad4532b5c4162817596c973 Mon Sep 17 00:00:00 2001 From: Bernhard Kiselka Date: Tue, 25 Mar 2014 20:01:56 +0100 Subject: [PATCH 3/9] test GetFeatureInfo with invalid HTML for IE11 I think I experience the same problem of issue #1177 As an example I modified the GetFeatureInfo example injecting the corrupt data that cause the error in IE11. Just click in the map. Obviously the not valid HTML5 is can't be read with DomParser() in IE11. One solution is pull request #1285 Another solution may be to check the INFO_FORMAT and do not call var features = this.format.read(doc); if it is text/html or text/plain (i.e. not a GML) as in showInfo() just the text is used (no GML features): document.getElementById('responseText').innerHTML = evt.text; --- ...tfeatureinfo-control_invalidHTML_IE11.html | 256 ++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 examples/getfeatureinfo-control_invalidHTML_IE11.html diff --git a/examples/getfeatureinfo-control_invalidHTML_IE11.html b/examples/getfeatureinfo-control_invalidHTML_IE11.html new file mode 100644 index 0000000000..4be3cb8ff7 --- /dev/null +++ b/examples/getfeatureinfo-control_invalidHTML_IE11.html @@ -0,0 +1,256 @@ + + + + + + + OpenLayers WMS Feature Info Example (GeoServer, special IE11 test with invalid local HTML) + + + + + + + +

Feature Info Example - special IE11 test with invalid local HTML

+ +
+ WMS, GetFeatureInfo +
+ +

+ Demonstrates the WMSGetFeatureInfo control for fetching information about a position from WMS (via GetFeatureInfo request). +

+ +
+

Tasmania

+

Click on the map to get feature info.

+
+
+
+
+ +
+
+
    +
  • + + +
  • +
  • + + +
  • +
+
    +
  • + + +
  • +
  • + + +
  • +
+
    +
  • + + +
  • +
  • + + +
  • +
+ + From 5405041bfb42dd8baae66070080d96300da1f5a7 Mon Sep 17 00:00:00 2001 From: Bernhard Kiselka Date: Tue, 25 Mar 2014 20:05:03 +0100 Subject: [PATCH 4/9] Revert "IE11 can't interpret window.ActiveXObject correctly anymore" This reverts commit be96646eca83e99f8af9784618f2d282e72138e7. --- lib/OpenLayers/Format/WPSExecute.js | 4 ++-- lib/OpenLayers/Format/XML.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Format/WPSExecute.js b/lib/OpenLayers/Format/WPSExecute.js index a23ce3906d..0795b0d180 100644 --- a/lib/OpenLayers/Format/WPSExecute.js +++ b/lib/OpenLayers/Format/WPSExecute.js @@ -80,10 +80,10 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, */ write: function(options) { var doc; - try { + if (window.ActiveXObject) { doc = new ActiveXObject("Microsoft.XMLDOM"); this.xmldom = doc; - } catch(e) { + } else { doc = document.implementation.createDocument("", "", null); } var node = this.writeNode("wps:Execute", options, doc); diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js index 235c051c7a..b3f60ce979 100644 --- a/lib/OpenLayers/Format/XML.js +++ b/lib/OpenLayers/Format/XML.js @@ -81,9 +81,8 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { * the object. */ initialize: function(options) { - try { + if(window.ActiveXObject) { this.xmldom = new ActiveXObject("Microsoft.XMLDOM"); - } catch(e) { } OpenLayers.Format.prototype.initialize.apply(this, [options]); // clone the namespace object and set all namespace aliases @@ -139,7 +138,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { * Since we want to be able to call this method on the prototype * itself, this.xmldom may not exist even if in IE. */ - if (!this.xmldom) { + if(window.ActiveXObject && !this.xmldom) { xmldom = new ActiveXObject("Microsoft.XMLDOM"); } else { xmldom = this.xmldom; @@ -872,7 +871,7 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { if (document.implementation && document.implementation.createDocument) { OpenLayers.Format.XML.document = document.implementation.createDocument("", "", null); - } else if (!this.xmldom) { + } else if (!this.xmldom && window.ActiveXObject) { this.xmldom = new ActiveXObject("Microsoft.XMLDOM"); } } From 435cdd5ac68139e6779a1535f0edc211a43f8c0c Mon Sep 17 00:00:00 2001 From: Bernhard Kiselka Date: Thu, 24 Nov 2016 15:22:31 +0100 Subject: [PATCH 5/9] Revert commit 2661b83b2645d3e834bf61919478697531c25b74 (IE11 can't interpret window.ActiveXObject correctly anymore) --- lib/OpenLayers/Format/WPSExecute.js | 2 +- lib/OpenLayers/Format/XML.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/OpenLayers/Format/WPSExecute.js b/lib/OpenLayers/Format/WPSExecute.js index 345ed8c3f2..31c3b83014 100644 --- a/lib/OpenLayers/Format/WPSExecute.js +++ b/lib/OpenLayers/Format/WPSExecute.js @@ -83,7 +83,7 @@ OpenLayers.Format.WPSExecute = OpenLayers.Class(OpenLayers.Format.XML, if (OpenLayers.Format.XML.supportActiveX) { doc = new ActiveXObject("Microsoft.XMLDOM"); this.xmldom = doc; - } catch(e) { + } else { doc = document.implementation.createDocument("", "", null); } var node = this.writeNode("wps:Execute", options, doc); diff --git a/lib/OpenLayers/Format/XML.js b/lib/OpenLayers/Format/XML.js index 33ab67e5d2..1af7e38b94 100644 --- a/lib/OpenLayers/Format/XML.js +++ b/lib/OpenLayers/Format/XML.js @@ -83,7 +83,6 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, { initialize: function(options) { if (OpenLayers.Format.XML.supportActiveX) { this.xmldom = new ActiveXObject("Microsoft.XMLDOM"); - } catch(e) { } OpenLayers.Format.prototype.initialize.apply(this, [options]); // clone the namespace object and set all namespace aliases From 4cbcf6bdbc7dd316821ffe8adf0596b8605aa6ab Mon Sep 17 00:00:00 2001 From: Bernhard Kiselka Date: Fri, 25 Nov 2016 01:40:02 +0100 Subject: [PATCH 6/9] fix for avoiding error if element has no property _eventCacheID adapted WMS of gutter examples/gutter.html --- examples/gutter.html | 8 ++++---- lib/OpenLayers/Events.js | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/gutter.html b/examples/gutter.html index 2c29aa79de..9c5772dbac 100644 --- a/examples/gutter.html +++ b/examples/gutter.html @@ -42,12 +42,12 @@

Gutter Example

- - - - - - -

Feature Info Example - special IE11 test with invalid local HTML

- -
- WMS, GetFeatureInfo -
- -

- Demonstrates the WMSGetFeatureInfo control for fetching information about a position from WMS (via GetFeatureInfo request). -

- -
-

Tasmania

-

Click on the map to get feature info.

-
-
-
-
- -
-
-
    -
  • - - -
  • -
  • - - -
  • -
-
    -
  • - - -
  • -
  • - - -
  • -
-
    -
  • - - -
  • -
  • - - -
  • -
- -