Set the ID of the image before registering events on it. The Event.observe
call uses the element ID to cache the listeners for later deletion, so this closes a leak. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2911 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+10
-9
@@ -175,6 +175,16 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
|
|||||||
|
|
||||||
image = document.createElement("img");
|
image = document.createElement("img");
|
||||||
|
|
||||||
|
//set generic properties
|
||||||
|
if (!id) {
|
||||||
|
id = OpenLayers.Util.createUniqueID("OpenLayersDiv");
|
||||||
|
}
|
||||||
|
if (!position) {
|
||||||
|
position = "relative";
|
||||||
|
}
|
||||||
|
OpenLayers.Util.modifyDOMElement(image, id, px, sz, position,
|
||||||
|
border, null, opacity);
|
||||||
|
|
||||||
if(delayDisplay) {
|
if(delayDisplay) {
|
||||||
image.style.display = "none";
|
image.style.display = "none";
|
||||||
OpenLayers.Event.observe(image, "load",
|
OpenLayers.Event.observe(image, "load",
|
||||||
@@ -191,15 +201,6 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
|
|||||||
image.src = imgURL;
|
image.src = imgURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set generic properties
|
|
||||||
if (!id) {
|
|
||||||
id = OpenLayers.Util.createUniqueID("OpenLayersDiv");
|
|
||||||
}
|
|
||||||
if (!position) {
|
|
||||||
position = "relative";
|
|
||||||
}
|
|
||||||
OpenLayers.Util.modifyDOMElement(image, id, px, sz, position,
|
|
||||||
border, null, opacity);
|
|
||||||
|
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|||||||
Reference in New Issue
Block a user