Make the derivation of the '_contentDivPadding' value safe in the case where the popup is already added to the map's containerDiv. (Closes #1938)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8980 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -785,9 +785,12 @@ OpenLayers.Popup = OpenLayers.Class({
|
|||||||
//use cached value if we have it
|
//use cached value if we have it
|
||||||
var contentDivPadding = this._contentDivPadding;
|
var contentDivPadding = this._contentDivPadding;
|
||||||
if (!contentDivPadding) {
|
if (!contentDivPadding) {
|
||||||
|
|
||||||
|
if (this.div.parentNode == null) {
|
||||||
//make the div invisible and add it to the page
|
//make the div invisible and add it to the page
|
||||||
this.div.style.display = "none";
|
this.div.style.display = "none";
|
||||||
document.body.appendChild(this.div);
|
document.body.appendChild(this.div);
|
||||||
|
}
|
||||||
|
|
||||||
//read the padding settings from css, put them in an OL.Bounds
|
//read the padding settings from css, put them in an OL.Bounds
|
||||||
contentDivPadding = new OpenLayers.Bounds(
|
contentDivPadding = new OpenLayers.Bounds(
|
||||||
@@ -800,10 +803,12 @@ OpenLayers.Popup = OpenLayers.Class({
|
|||||||
//cache the value
|
//cache the value
|
||||||
this._contentDivPadding = contentDivPadding;
|
this._contentDivPadding = contentDivPadding;
|
||||||
|
|
||||||
|
if (this.div.parentNode == document.body) {
|
||||||
//remove the div from the page and make it visible again
|
//remove the div from the page and make it visible again
|
||||||
document.body.removeChild(this.div);
|
document.body.removeChild(this.div);
|
||||||
this.div.style.display = "";
|
this.div.style.display = "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return contentDivPadding;
|
return contentDivPadding;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user