×

Discussion Board

Results 1 to 7 of 7

Thread: Type Errors

  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    12

    Type Errors

    (1) SyntaxError: syntax error
    [Break On This Error]

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//E

    (2) TypeError: e is undefined
    [Break On This Error]

    ...,k,c,p,j;if(e!==a.ownerDocument){c=a.attributes;b=e.createElement(a.nodeName);fo...

    I am trying to migrate a map from Maps24 to Nokia as Maps24 has stopped working. These errors are in base.js line 10 and line 100 but despite several hours of trying I have been unable to resolve them.

    The map is at www.sysmaps.co.uk/sysmaps_navteq.html. Thanks

  2. #2
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: Type Errors

    If you can assume that e (whatever it is) has the value undefined, then the statement e!==a.ownerDocument will resolve to true, hence the JavaScript error is caused by the statement e.createElement(a.nodeName);. The createElement() method is used to add additional "stuff" into the DOM, so it is a reasonable assumption that e needs to be a pre-existing DOM element.

    The only place I know where the HERE Maps API for JavaScript accepts a DOM element, is the initialisation of the map Display itself. i.e. lines 307 onwards in your code:

    Code:
    mapContainer = document.getElementById("mapContainer");
    // Create a map inside the map container DOM node
    map = new nokia.maps.map.Display(mapContainer, {
    	// Initial center and zoom level of the map
    	center: coords,
    	zoomLevel: 14,
    	components: [
    		new nokia.maps.map.component.Behavior(),
    		new nokia.maps.map.component.ZoomBar(),
    		new nokia.maps.map.component.ScaleBar(),
    		new nokia.maps.map.component.TypeSelector(),
    		new nokia.maps.map.component.Overview(),
    		bubbleContainer
    	]
    });
    The error will occur if mapContainer has not yet been properly defined. There are two possible causes. Either the <script> code is running before <div id="mapContainer"> has been added to the <body>, which looks unlikely in this case or the variable mapContainer and <div id="mapContainer"> is being confused by the parser.

    I have come across this with the IE browser before: - It would make more sense to define the variable mapContainer with an extra var as shown:

    Code:
    var mapContainer = document.getElementById("mapContainer");
    // Create a map inside the map container DOM node
    var map = new nokia.maps.map.Display(mapContainer, {
    	// Initial center and zoom level of the map
    	center: coords,
    	zoomLevel: 14,
    	components: [
    		new nokia.maps.map.component.Behavior(),
    		new nokia.maps.map.component.ZoomBar(),
    		new nokia.maps.map.component.ScaleBar(),
    		new nokia.maps.map.component.TypeSelector(),
    		new nokia.maps.map.component.Overview(),
    		bubbleContainer
    	]
    });
    The following meta tag would be useful for IE as well:

    Code:
    <meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9; IE=EmulateIE10;"/>

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    12

    Re: Type Errors

    Thanks for this. I have changed the variable names. I still get this error on loading but it does not seem to affect the loading.

    SyntaxError: syntax error
    [Break On This Error]

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//E

    The type error is still there in base.js line 100 when I search for a place:

    TypeError: e is undefined
    [Break On This Error]

    ...,k,c,p,j;if(e!==a.ownerDocument){c=a.attributes;b=e.createElement(a.nodeName);fo...

  4. #4
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: Type Errors

    According to Firebug, The syntax error lies in your own JavaScript function gpsgate.js line 10.

    Code:
    GpsGate = {};

    I am not getting an error in base.js line 100 but I'm not sure what you mean by "search for a place" - your address geocoding function seemed to be working fine for me in IE, FF and Google Chrome.
    Right clicking for reverse geocoding is failing in IE - it is placing the white marker, but not replacing it with the Black one - the error appears to be line 1530 which presumably is within showAddress2.
    The reverse geocoding code is duplicating the job of the ContextMenu component by the way.

    Maybe you need to clear the cache? To debug the IE error I would add a set of alerts into the function to narrow down the error.

  5. #5
    Registered User
    Join Date
    Jul 2013
    Posts
    12

    Re: Type Errors

    These are the errors I am getting in Firefox, Maxthon etc:

    SyntaxError: syntax error
    [Break On This Error]

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//E

    base.js (line 10)
    TypeError: e is undefined
    [Break On This Error]

    ...,k,c,p,j;if(e!==a.ownerDocument){c=a.attributes;b=e.createElement(a.nodeName);fo...

    base.js (line 100)

    The first type error occur on load. When I put in an address and search, as you say the white marker places itself but the black marker is supposed to get an address lookup. This fails since e is undefined.

    I have used gpsgate for about four years and it worked fine with Maps24. I cannot change the gpsgate.js as it is remote.

    Is there a way to attach a screen shot?

  6. #6
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: Type Errors

    You can attach screenshots using the "insert image button" in the strip above the text box.

    I have neither access to the unminified JS library nor the ability to modify scripts and debug your website, but I can see the site working in some browsers as shown:

    Chrome_screenshot.png Chrome (I didn't download additional plugins when requested)
    ff_screenshot.png Firefox.
    I even tried IE10 on mobile and that was rendering as well. I couldn't get IE8 to work mind you.

    From what I can ascertain, it look like the base.js syntax error is due conflicting shims due to the multiple libraries you are using. I would suggest placing the map library <script> tag at the top of the page and see which other library complains. I'm guessing that re-ordering may help, or at least find where the conflict issue lies.

    A couple of other ideas:

    1) You probably don't need with=all in the <script> tag - this would reduce the number of files loaded.

    2) To eliminate browser issues it would be helpful if the page was valid HTML try a vailidator like: http://go.microsoft.com/fwlink/?Link...ps_navteq.html

  7. #7
    Registered User
    Join Date
    Jul 2013
    Posts
    12

    Re: Type Errors

    Thanks for all your help. It now works - I had duplicated the variable for the bubble. This did not show up in Firebug on Firefox but your suggestion of Chrome worked and it showed my line number.

    If you search for 'Premach' at www.sysmaps.co.uk/sysmaps_navteq.html then you get all the right markers and lookups.

Similar Threads

  1. Hi Mahabub ...Help required on sendcommands() for Type 4 type tags
    By rbrahmaa in forum Near Field Communication
    Replies: 4
    Last Post: 2012-01-04, 07:35
  2. Type of Parameters in IssueHTTPPostL() > Errors
    By gregb34 in forum Symbian Networking & Messaging (Closed)
    Replies: 9
    Last Post: 2008-08-20, 20:53
  3. Replies: 2
    Last Post: 2008-08-12, 17:06
  4. Replies: 0
    Last Post: 2006-07-06, 09:31
  5. How to convert type TPtr to type TBuf?
    By yfzfq in forum Symbian
    Replies: 1
    Last Post: 2004-06-02, 10:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •