Fixes #5812. =? will be detected even when it has been escaped during data serialization.
authorjaubourg <j@ubourg.net>
Sun, 9 Jan 2011 20:48:52 +0000 (21:48 +0100)
committerjaubourg <j@ubourg.net>
Sun, 9 Jan 2011 20:48:52 +0000 (21:48 +0100)
src/ajax/jsonp.js
test/unit/ajax.js

index 0af0056..f4b324e 100644 (file)
@@ -1,7 +1,7 @@
 (function( jQuery ) {
 
 var jsc = jQuery.now(),
-       jsre = /\=\?(&|$)/,
+       jsre = /\=(?:\?|%3F)(&|$)/i,
        rquery_jsonp = /\?/;
 
 // Default jsonp settings
index d849cff..773088f 100644 (file)
@@ -1081,7 +1081,7 @@ test("jQuery.getScript(String, Function) - no callback", function() {
 });
 
 test("jQuery.ajax() - JSONP, Local", function() {
-       expect(9);
+       expect(10);
 
        var count = 0;
        function plus(){ if ( ++count == 9 ) start(); }
@@ -1131,6 +1131,22 @@ test("jQuery.ajax() - JSONP, Local", function() {
        jQuery.ajax({
                url: "data/jsonp.php",
                dataType: "jsonp",
+               data: {
+                       callback: "?"
+               },
+               success: function(data){
+                       ok( data.data, "JSON results returned (GET, processed data callback)" );
+                       plus();
+               },
+               error: function(data){
+                       ok( false, "Ajax error JSON (GET, processed data callback)" );
+                       plus();
+               }
+       });
+
+       jQuery.ajax({
+               url: "data/jsonp.php",
+               dataType: "jsonp",
                jsonp: "callback",
                success: function(data){
                        ok( data.data, "JSON results returned (GET, data obj callback)" );