aytee / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
Apache License 2.0
0 stars 0 forks source link

parentNode is null or not an object #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm only seeing this in IE, but might just be hidden/ignored in other browsers.

The code is pretty complex, but the part creating the marker is within a loop 
and looks something like this:

blackMarker = new MarkerWithLabel({
  position: new google.maps.LatLng(cityData[i].GoogleLatitude, cityData[i].GoogleLongitude),
  draggable: false,
  map: map,
  icon: "/Content/Images/black-dot.png",
  flat: true,
  labelContent: cityData[i].DisplayName,
  labelAnchor: new google.maps.Point(x, y),
  labelClass: "mapLabel",
  labelInBackground: true,
  labelVisible: displayLabel
});

What steps will reproduce the problem?
1. Load the application: http://tripplanner.airtreks.com/HtmlUi
2. Add a few cities to your route: SFO, LON, BKK, SYD, SFO
3. Click Get Price
4. JS error occurs here.

The JS Error is as follows:

---------------------

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; 
.NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.2; .NET CLR 3.0.04506.648; 
.NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Tue, 13 Sep 2011 22:22:59 UTC

Message: 'null' is null or not an object
Line: 28
Char: 926
Code: 0
URI: http://maps.gstatic.com/intl/en_us/mapfiles/api-3/6/4/main.js

Message: 'this.labelDiv_.parentNode' is null or not an object
Line: 10
Char: 204
Code: 0
URI: http://maps.gstatic.com/intl/en_us/mapfiles/api-3/6/4/main.js

Message: 'this.labelDiv_.parentNode' is null or not an object
Line: 10
Char: 204
Code: 0
URI: http://maps.gstatic.com/intl/en_us/mapfiles/api-3/6/4/main.js

-----------------------

Version: 1.1.5
Browser / Operating System: IE / Windows

Honestly, this might be being caused by something higher up, but seems to be 
pointing to something related to the MarkerWithLabel library that I'm using.

Original issue reported on code.google.com by justin.k...@gmail.com on 13 Sep 2011 at 10:27

GoogleCodeExporter commented 9 years ago
Did a little more digging, seems like this error happens anytime a 
MarkerwithLabel is removed from the map with .setMap(null);

For example:

if (defaultCityMarkers) {
  for (i = 0; i < defaultCityMarkers.length; i++) {
    defaultCityMarkers[i].setMap(null);
  }
}

Is this a bug or am I doing something wrong?

Original comment by justin.k...@gmail.com on 14 Sep 2011 at 12:38

GoogleCodeExporter commented 9 years ago
Out of curiosity, do you see the same error if you change "new MarkerWithLabel" 
to "new google.maps.Marker" ?

Also, put try { xxx } catch (e ) { alert(e.message); } around the loop where 
you call setMap(null) to see what error message appears.

Original comment by garylitt...@gmail.com on 14 Sep 2011 at 4:02

GoogleCodeExporter commented 9 years ago
Still testing a few things, but to get back to you, the error message when 
using a try/catch is 'this.labelDiv_.parentNode' is null or not an object.

I'm guessing it has something to do with how I'm loading/unloading the markers, 
not actually with this add-on.  I'll return with more info as/if I have it.

Original comment by justin.k...@gmail.com on 14 Sep 2011 at 6:20

GoogleCodeExporter commented 9 years ago
Are you calling the code to remove markers from the map before the markers have 
been added to the map.

Original comment by garylitt...@gmail.com on 15 Sep 2011 at 8:34

GoogleCodeExporter commented 9 years ago
Request for info was ignored, so marking this bug as invalid.

Original comment by garylitt...@gmail.com on 21 Feb 2012 at 7:49