The FramedCloud popup throws an error if you attempt to call setContentHTML

before you add the popup to the map. To prevent this, don't call construct
or updateBlocks if relativePosition is null, to prevent this error message.
r=elemoine, (Pullup #1479)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@6765 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-04-02 14:08:01 +00:00
parent f95f280dc7
commit 797c57586a
3 changed files with 33 additions and 3 deletions

View File

@@ -248,6 +248,12 @@ OpenLayers.Popup.Framed =
* Method: createBlocks
*/
createBlocks: function() {
if (!this.relativePosition) {
// this.relativePosition can't be set until we have a map
// set: if it's not set, we can't create blocks. (See #1479)
return false;
}
this.blocks = [];
var position = this.positionBlocks[this.relativePosition];
@@ -274,6 +280,8 @@ OpenLayers.Popup.Framed =
block.div.appendChild(block.image);
this.groupDiv.appendChild(block.div);
}
return true;
},
/**
@@ -283,11 +291,14 @@ OpenLayers.Popup.Framed =
* the popup's blocks in their appropropriate places.
*/
updateBlocks: function() {
if (!this.blocks) {
this.createBlocks();
var cont = this.createBlocks();
if (!cont) {
return false;
}
}
var position = this.positionBlocks[this.relativePosition];
for (var i = 0; i < position.blocks.length; i++) {