Skip to content

Commit ee845c4

Browse files
committed
Merge branch 'master' of http://github.com/rwldrn/jquery
2 parents 36143ce + 3b50eac commit ee845c4

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

src/ajax.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ jQuery.extend({
208208
s.data = jQuery.param( s.data, s.traditional );
209209
}
210210

211+
// If the jsonpCallback has been set, we can assume that dataType is jsonp
212+
// Ticket #5803
213+
if ( s.jsonpCallback ) {
214+
s.dataType = "jsonp";
215+
}
216+
211217
// Handle JSONP Parameter Callbacks
212218
if ( s.dataType === "jsonp" ) {
213219
if ( type === "GET" ) {

src/event.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jQuery.event = {
3232

3333
if ( handler === false ) {
3434
handler = returnFalse;
35+
} else if ( !handler ) {
36+
// Fixes bug #7229. Fix recommended by jdalton
37+
return;
3538
}
3639

3740
var handleObjIn, handleObj;

test/unit/ajax.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,21 @@ test("jQuery.ajax() - JSONP, Local", function() {
799799
plus();
800800
}
801801
});
802+
803+
// Supports Ticket #5803
804+
jQuery.ajax({
805+
url: "data/jsonp.php",
806+
jsonpCallback: "jsonpResults",
807+
success: function(data){
808+
ok( data.data, "JSON results returned without dataType:jsonp when jsonpCallback is defined" );
809+
plus();
810+
},
811+
error: function(data){
812+
ok( false, "Ajax error JSON (GET, custom callback name)" );
813+
plus();
814+
}
815+
});
816+
802817
});
803818

804819
test("JSONP - Custom JSONP Callback", function() {

test/unit/event.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
module("event");
22

3+
test("null or undefined handler", function() {
4+
expect(2);
5+
// Supports Fixes bug #7229
6+
try {
7+
8+
jQuery("#firstp").click(null);
9+
10+
ok(true, "Passing a null handler will not throw an exception");
11+
12+
} catch (e) {}
13+
14+
try {
15+
16+
jQuery("#firstp").click(undefined);
17+
18+
ok(true, "Passing an undefined handler will not throw an exception");
19+
20+
} catch (e) {}
21+
});
22+
323
test("bind(), with data", function() {
424
expect(3);
525
var handler = function(event) {

0 commit comments

Comments
 (0)