title: ReferenceError: function parseXml undefined in Firefox
body: <p>I am getting this strange error even when <code>parseXml</code> is <strong>defined</strong>. The piece of code works <code>fine in Chrome</code> but NOT in <code>Firefox</code>. </p>
  
  <pre><code>   $(document).on("pageinit", "#map-page", function () {
         var defaultLatLng = new google.maps.LatLng(56.8517843, 14.828458); // Default somewhere to Växjö when no geolocation support
         if (navigator.geolocation) {
             var stations = [];
             $.ajax({
                 type: "GET",
                 url: "busstations.xml",
                 dataType: "xml",
                 success: parseXml
             });
  
             function parseXml(xml) {
                 $(xml).find('station').each(function () {
                     var name = $(this).find("name").text();
                     var localurl = $(this).find("localurl").text();
                     var latitude = $(this).find("latitude").text();
                     var longitude = $(this).find("longitude").text();
                     navigator.geolocation.getCurrentPosition(success, fail, {
                         maximumAge: 500000,
                         enableHighAccuracy: true,
                         timeout: 6000
                     });
  
                     function success(pos) {
                         currentLatitude = pos.coords.latitude;
                         currentLongitude = pos.coords.longitude;
                         console.log(pos.coords.latitude + " " + pos.coords.longitude);
  
                     }
  
                     function fail(error) {
                         alert("No GL support!");
                     }
  
                     stations.push({
                         "name": name,
                         "localurl": localurl
                     });
                     console.log(JSON.stringify(stations));
  
  
                 });
             }
         }
     });
  </code></pre>
  
  <p>However if I remove the <strong>if(navigator.geolocation)</strong> check condition on the 3rd line, then it also works fine in Firefox and there is also no such undefined <code>ReferenceError</code>.</p>
  
  <p>Also if I bring this <strong>if(navigator.geolocation)</strong> check condition inside the <code>parseXml</code> function, the code works fine. Wonder what is causing the problem in <code>Firefox</code>.</p>