diff --git a/lib/OpenLayers/Popup/Framed.js b/lib/OpenLayers/Popup/Framed.js index ebd017f6a1..4b864b6f7e 100644 --- a/lib/OpenLayers/Popup/Framed.js +++ b/lib/OpenLayers/Popup/Framed.js @@ -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++) { diff --git a/tests/Popup/FramedCloud.html b/tests/Popup/FramedCloud.html new file mode 100644 index 0000000000..b7f33257a5 --- /dev/null +++ b/tests/Popup/FramedCloud.html @@ -0,0 +1,18 @@ + + + + + + +
+ + diff --git a/tests/list-tests.html b/tests/list-tests.html index 94ba67900c..209fb506d8 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -40,6 +40,7 @@
  • Popup.html
  • Popup/Anchored.html
  • Popup/AnchoredBubble.html
  • +
  • Popup/FramedCloud.html
  • Feature.html
  • Feature/Vector.html
  • Style.html