mde / timezone-js

DEPRECATED: Timezone-enabled JavaScript Date object. Uses Olson zoneinfo files for timezone data.
824 stars 182 forks source link

Unhelpful error message if additional libraries (jQuery, Zepto) are not loaded #21

Closed itsuryev closed 12 years ago

itsuryev commented 12 years ago
    if ((!fleegix || typeof fleegix.xhr === 'undefined') && typeof $.ajax === 'undefined') {
      throw new Error('Please use the Fleegix.js XHR module, jQuery ajax, Zepto ajax, or define your own transport mechanism for downloading zone files.');
    }

Here if additional libraries are not loaded $ is undefined and we try to get property of undefined which causes JavaScript error and we never get to the throw new Error part. It should be

    if ((!fleegix || typeof fleegix.xhr === 'undefined') && (!$ || typeof $.ajax === 'undefined')) {