Skip to content
Permalink
Browse files

Merge branch 'master' of http://github.com/rwldrn/jquery

  • Loading branch information
jeresig committed Oct 25, 2010
2 parents 36143ce + 3b50eac commit ee845c49758eeb5236d9e4520b7921e12d5f29b9
Showing with 44 additions and 0 deletions.
  1. +6 −0 src/ajax.js
  2. +3 −0 src/event.js
  3. +15 −0 test/unit/ajax.js
  4. +20 −0 test/unit/event.js
@@ -208,6 +208,12 @@ jQuery.extend({
s.data = jQuery.param( s.data, s.traditional );
}

// If the jsonpCallback has been set, we can assume that dataType is jsonp
// Ticket #5803
if ( s.jsonpCallback ) {
s.dataType = "jsonp";
}

// Handle JSONP Parameter Callbacks
if ( s.dataType === "jsonp" ) {
if ( type === "GET" ) {
@@ -32,6 +32,9 @@ jQuery.event = {

if ( handler === false ) {
handler = returnFalse;
} else if ( !handler ) {
// Fixes bug #7229. Fix recommended by jdalton
return;
}

var handleObjIn, handleObj;
@@ -799,6 +799,21 @@ test("jQuery.ajax() - JSONP, Local", function() {
plus();
}
});

// Supports Ticket #5803
jQuery.ajax({
url: "data/jsonp.php",
jsonpCallback: "jsonpResults",
success: function(data){
ok( data.data, "JSON results returned without dataType:jsonp when jsonpCallback is defined" );
plus();
},
error: function(data){
ok( false, "Ajax error JSON (GET, custom callback name)" );
plus();
}
});

});

test("JSONP - Custom JSONP Callback", function() {
@@ -1,5 +1,25 @@
module("event");

test("null or undefined handler", function() {
expect(2);
// Supports Fixes bug #7229
try {

jQuery("#firstp").click(null);

ok(true, "Passing a null handler will not throw an exception");

} catch (e) {}

try {

jQuery("#firstp").click(undefined);

ok(true, "Passing an undefined handler will not throw an exception");

} catch (e) {}
});

test("bind(), with data", function() {
expect(3);
var handler = function(event) {

0 comments on commit ee845c4

Please sign in to comment.
You can’t perform that action at this time.