coderifous / jquery-localize

a jQuery plugin that makes it easy to internationalize your web site.
465 stars 142 forks source link

Localization file fetch stomps global timeout param #1

Closed culbert closed 13 years ago

culbert commented 15 years ago

Intro: The script uses the getJSON utility function. This fn does not allow you to pass the aync param. The current script does a synchronous fetch using the getJSON function by setting then restoring the global ajaxSettings using the ajaxSetup function.

Problem: If the timeout is undefined prior to the localize call, then, when the previous value is stored away, it is stored as undefined. When you attempt to restore the timeout, since its original value is undefined, it does not reset the timeout back to undefined from the 500ms value that is set by the script - the ajaxSetup function simply calls jQuery.extend which ignores undefined vals. The result is that after executing the localize function, all ajax requests longer than 500ms timeout.

coderifous commented 13 years ago

Got rid of $.ajaxSetup and any possible side effects. [Closed by 4a1838158978194857c370e83f1fa5fdfe82e35d]