Added alternatvie way to initialize the map object, without passing a
div to the constructor. Original patch by tcoulter, modifications by me and tschaub. r=tschaub (closes #1901) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9068 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -450,7 +450,6 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
initialize: function (object, element, eventTypes, fallThrough, options) {
|
||||
OpenLayers.Util.extend(this, options);
|
||||
this.object = object;
|
||||
this.element = element;
|
||||
this.fallThrough = fallThrough;
|
||||
this.listeners = {};
|
||||
|
||||
@@ -471,7 +470,7 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
|
||||
// if a dom element is specified, add a listeners list
|
||||
// for browser events on the element and register them
|
||||
if (this.element != null) {
|
||||
if (element != null) {
|
||||
this.attachToElement(element);
|
||||
}
|
||||
},
|
||||
@@ -514,6 +513,10 @@ OpenLayers.Events = OpenLayers.Class({
|
||||
* element - {HTMLDOMElement} a DOM element to attach browser events to
|
||||
*/
|
||||
attachToElement: function (element) {
|
||||
if(this.element) {
|
||||
OpenLayers.Event.stopObservingElement(this.element);
|
||||
}
|
||||
this.element = element;
|
||||
for (var i=0, len=this.BROWSER_EVENTS.length; i<len; i++) {
|
||||
var eventType = this.BROWSER_EVENTS[i];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user