[OpenLayers-Dev] Bug Report about Popups in map.js

Frédéric Junod frederic.junod at camptocamp.com
Thu Nov 15 03:07:48 EST 2007


Le Thu, 15 Nov 2007 14:18:58 +0800,
"li ethan" <ethan919 at gmail.com> a écrit :

> Dear listers!
>     Did anyone notice there might be a bug at addPopup:
> function(popup, exclusive) in Map.js.
> this method first remove all the popups when the exclusive flag is
> true,and I think there is a problem is this statements
>             for(var i=0; i < this.popups.length; i++) {
>                 this.removePopup(this.popups[i]);
>             }
> 
> and the removePopup method use array.splice(i,1) to cut off the
> array,there might have some elements in this array never get
> removed,like the element in index 1 will not be removed because it be
> shift to index 0 after first loop.Am I correct?

You're correct ...

The loop should be:

    for (var i = this.popups.length - 1; i >= 0; --i) {
       this.removePopup(this.popups[i]);
    }

I've opened a ticket for that, http://trac.openlayers.org/ticket/1149

Regards,

fredj

-- 
Frédéric Junod
Camptocamp SA



More information about the Dev mailing list