aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2010-10-25 13:05:11 -0700
committerJohn Resig <jeresig@gmail.com>2010-10-25 13:05:11 -0700
commitee845c49758eeb5236d9e4520b7921e12d5f29b9 (patch)
tree3e15e88139ec9f45c05b911d8fc267bf94e9c58a
parent36143ce63359cc64ebac696f27e4e7968caee902 (diff)
parent3b50eaca2cd0b1439235e39c4e98a6438e8f55b2 (diff)
downloadjquery-ee845c49758eeb5236d9e4520b7921e12d5f29b9.tar.gz
jquery-ee845c49758eeb5236d9e4520b7921e12d5f29b9.zip
Merge branch 'master' of http://github.com/rwldrn/jquery
-rw-r--r--src/ajax.js6
-rw-r--r--src/event.js3
-rw-r--r--test/unit/ajax.js15
-rw-r--r--test/unit/event.js20
4 files changed, 44 insertions, 0 deletions
diff --git a/src/ajax.js b/src/ajax.js
index a40e223e7..915bbaa3e 100644
--- a/src/ajax.js
+++ b/src/ajax.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" ) {
diff --git a/src/event.js b/src/event.js
index fb5a3ef8c..d491ae8a1 100644
--- a/src/event.js
+++ b/src/event.js
@@ -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;
diff --git a/test/unit/ajax.js b/test/unit/ajax.js
index 5704d73e0..14c621826 100644
--- a/test/unit/ajax.js
+++ b/test/unit/ajax.js
@@ -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() {
diff --git a/test/unit/event.js b/test/unit/event.js
index f3d314884..5efa0ec51 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -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) {