From ffab22ba198848bea952f88f2f34a7aad2597d29 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Wed, 9 Apr 2008 16:06:23 +0000 Subject: [PATCH] 2.6 introduced a regression that maps could not be created when the Object prototype is extended. Although OpenLayers is not designed to work when this fundamental violation of Javascript is in place, we can at least not fail so miserably in this case: this gets us back to a similar level of functionality as we had in 2.5. This was brought up by a user working on a viamichelin layer, which apparently extends the object prototype (bad!), and fixed in conjuction with tschaub. r=pgiraud,tschaub (Pullup #1502) git-svn-id: http://svn.openlayers.org/trunk/openlayers@6832 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Events.js | 4 +++- tests/Extras.html | 21 +++++++++++++++++++++ tests/list-tests.html | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/Extras.html diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index 0a6349dfef..80a95ff7ee 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -532,7 +532,9 @@ OpenLayers.Events = OpenLayers.Class({ */ register: function (type, obj, func) { - if (func != null) { + if (func != null && + ((this.eventTypes && OpenLayers.Util.indexOf(this.eventTypes, type) != -1) || + OpenLayers.Util.indexOf(this.BROWSER_EVENTS, type) != -1)) { if (obj == null) { obj = this.object; } diff --git a/tests/Extras.html b/tests/Extras.html new file mode 100644 index 0000000000..948f3abf99 --- /dev/null +++ b/tests/Extras.html @@ -0,0 +1,21 @@ + + + + + + +
+ + diff --git a/tests/list-tests.html b/tests/list-tests.html index 8ef9a61134..18823a8397 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -1,5 +1,6 @@