git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8e40a84
)
Fixes #8277. Sets data to undefined rather than null when it is not provided in ajax...
author
jaubourg
<j@ubourg.net>
Tue, 15 Feb 2011 20:47:52 +0000
(21:47 +0100)
committer
jaubourg
<j@ubourg.net>
Tue, 15 Feb 2011 20:53:38 +0000
(21:53 +0100)
src/ajax.js
patch
|
blob
|
history
test/unit/ajax.js
patch
|
blob
|
history
diff --git
a/src/ajax.js
b/src/ajax.js
index
7ef8dec
..
76a2dc8
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-164,7
+164,7
@@
jQuery.fn.extend({
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
- params = null;
+ params = undefined;
// Otherwise, build a param string
} else if ( typeof params === "object" ) {
// Otherwise, build a param string
} else if ( typeof params === "object" ) {
@@
-256,7
+256,7
@@
jQuery.each( [ "get", "post" ], function( i, method ) {
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
- data = null;
+ data = undefined;
}
return jQuery.ajax({
}
return jQuery.ajax({
@@
-272,7
+272,7
@@
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery.extend({
getScript: function( url, callback ) {
jQuery.extend({
getScript: function( url, callback ) {
- return jQuery.get( url, null, callback, "script" );
+ return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
},
getJSON: function( url, data, callback ) {
diff --git
a/test/unit/ajax.js
b/test/unit/ajax.js
index
c9c0611
..
80da7f8
100644
(file)
--- a/
test/unit/ajax.js
+++ b/
test/unit/ajax.js
@@
-1196,6
+1196,21
@@
test("load(String, String, Function)", function() {
});
});
});
});
+test("jQuery.get(String, Function) - data in ajaxSettings (#8277)", function() {
+ expect(1);
+ stop();
+ jQuery.ajaxSetup({
+ data: "helloworld"
+ });
+ jQuery.get(url('data/echoQuery.php'), function(data) {
+ ok( /helloworld$/.test( data ), 'Data from ajaxSettings was used');
+ jQuery.ajaxSetup({
+ data: null
+ });
+ start();
+ });
+});
+
test("jQuery.get(String, Hash, Function) - parse xml and use text() on nodes", function() {
expect(2);
stop();
test("jQuery.get(String, Hash, Function) - parse xml and use text() on nodes", function() {
expect(2);
stop();