git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes #7568. Follow-up fix for #5862. Objects with a length property weren't serializ...
[jquery.git]
/
src
/
ajax
/
jsonp.js
diff --git
a/src/ajax/jsonp.js
b/src/ajax/jsonp.js
index
883876f
..
cbe3680
100644
(file)
--- a/
src/ajax/jsonp.js
+++ b/
src/ajax/jsonp.js
@@
-1,20
+1,20
@@
(function( jQuery ) {
var jsc = jQuery.now(),
(function( jQuery ) {
var jsc = jQuery.now(),
- jsre = /(\=)(?:\?|%3F)(&|$)|()(?:\?\?|%3F%3F)()/i;
+ jsre = /(\=)\?(&|$)|()\?\?()/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
- return "jsonp" + jsc++;
+ return jQuery.expando + "_" + ( jsc++ );
}
}
+});
// Detect, normalize options and install callbacks for jsonp requests
// Detect, normalize options and install callbacks for jsonp requests
-// (dataIsString is used internally)
-}).ajaxPrefilter("json jsonp", function(s, originalSettings, dataIsString) {
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) {
- dataIsString = ( typeof(s.data) === "string" );
+ dataIsString = ( typeof s.data === "string" );
if ( s.dataTypes[ 0 ] === "jsonp" ||
originalSettings.jsonpCallback ||
if ( s.dataTypes[ 0 ] === "jsonp" ||
originalSettings.jsonpCallback ||
@@
-46,23
+46,25
@@
jQuery.ajaxSetup({
s.url = url;
s.data = data;
s.url = url;
s.data = data;
- window [ jsonpCallback ] = function( response ) {
- responseContainer = [response];
+ window[ jsonpCallback ] = function( response ) {
+ responseContainer = [ response ];
};
};
- s.complete = [function() {
+ s.complete = [ function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( previous) {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( previous) {
- if ( responseContainer && jQuery.isFunction ( previous ) ) {
- window[ jsonpCallback ] ( responseContainer[0] );
+ if ( responseContainer && jQuery.isFunction( previous ) ) {
+ window[ jsonpCallback ] ( responseContainer[ 0 ] );
}
} else {
// else, more memory leak avoidance
}
} else {
// else, more memory leak avoidance
- try{ delete window[ jsonpCallback ]; } catch(e){}
+ try{
+ delete window[ jsonpCallback ];
+ } catch( e ) {}
}
}, s.complete ];
}
}, s.complete ];
@@
-81,6
+83,6
@@
jQuery.ajaxSetup({
// Delegate to script
return "script";
}
// Delegate to script
return "script";
}
-});
+} );
})( jQuery );
})( jQuery );