rmbratcher / gmaps-utility-gis

Automatically exported from code.google.com/p/gmaps-utility-gis
0 stars 0 forks source link

_unsetMap issues in IE8 #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
1. Open gmaps-utility-gis/agsjs/examples/gmapslayer.html in IE8 (or IE9 + IE8 
standards mode)
2. Click the reload button
3. Notice one of several errors shown below

Can be reproduced from here:
http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.03/examples/gmapslayer.
html

google is undefined.  You can get around this by using window.google as is done 
elsewhere in this file:

      if (google && google.maps && google.maps.event) {

parentNode is null:

        this._element.parentNode.removeChild(this._element);
        this._controlDiv.parentNode.removeChild(this._controlDiv);
        this._topDiv.parentNode.removeChild(this._topDiv);

Original issue reported on code.google.com by coreya...@gmail.com on 23 Aug 2012 at 12:21

GoogleCodeExporter commented 8 years ago
Seems dom-construct contains a destroy method which handles removing the child 
from the parent...I assume dojo.destroy does the same.  This code works in IE8:

    _unsetMap: function (map, layersDiv) {
        var google = window.google;
        dojo.forEach(this._connects, dojo.disconnect, dojo);
        if (this._streetView) {
            this._streetView.setVisible(false);
        }
        if (google && google.maps && google.maps.event) {
            if (this._gmapTypeChangeHandle)
                google.maps.event.removeListener(this._gmapTypeChangeHandle);
            if (this._svVisibleHandle)
                google.maps.event.removeListener(this._svVisibleHandle);
        }
        dojo.destroy(this._element);
        dojo.destroy(this._controlDiv);
        dojo.destroy(this._topDiv);
    },

Original comment by coreya...@gmail.com on 23 Aug 2012 at 4:29