[OpenLayers-Dev] about Opera and events

Juan G juangon at gmail.com
Mon May 5 03:57:47 EDT 2008


Hello to everybody,

After some investigation, I´ve found out some serious troubles in DOM
manipulation in the same DOM Object that fired the event in Opera. One good
example of this is the "OpenLayers.LayerSwitcher" object, in the
"onInputClick" function:

onInputClick: function(e) {
>
>         if (!this.inputElem.disabled) {
>             if (this.inputElem.type == "radio") {
>                 this.inputElem.checked = true;
>                 this.layer.map.setBaseLayer(this.layer);
>             } else {
>                 this.inputElem.checked = !this.inputElem.checked;
>                 this.layerSwitcher.updateMap();
>             }
>         }
>         OpenLayers.Event.stop(e);
>     },


I´ve customized the layerSwicher and changed the "onInputClick" function. In
my layerSwitcher after clicking in a layer checkbox, it doesn´t update the
map. I made this to have a button (Control) that updates the map when
clicking it. After doing this I realised it doesn´t work in Opera, but works
well in Safari, Firefox and IE 6,7. I think this works now in OpenLayers
because it redraws again the layerswitcher, and the state of the layer is in
the "Layer" object, not int the checkbox element itself. It works well with
the "labelSpan" event that fires the same "onInputClick" function, so the
problem begins when a DOM object fires an event and you must change the same
DOM element that fired it. Surprisingly, it works when you changed the value
to "false" (checked=false), but not when you have to change to "true".

I think something happens with the OpenLayers event listener (or with Opera
9.5 beta 2) when you have to change a DOM object attribute (for example,
"checked" attribute in a "checkbox" object).

Thanks very much for your attention...


P.S.: there is another version of the map viewer, if someone want to see it
here is the URL: http://www.mirame.chduero.es/DMADuero_09_Viewer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080505/c5054a4d/attachment.html


More information about the Dev mailing list