File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ jQuery.param = function( a, traditional ) {
7070 encodeURIComponent ( value == null ? "" : value ) ;
7171 } ;
7272
73+ if ( a == null ) {
74+ return "" ;
75+ }
76+
7377 // If an array was passed in, assume that it is an array of form elements.
7478 if ( Array . isArray ( a ) || ( a . jquery && ! jQuery . isPlainObject ( a ) ) ) {
7579
Original file line number Diff line number Diff line change 11QUnit . module ( "serialize" , { teardown : moduleTeardown } ) ;
22
33QUnit . test ( "jQuery.param()" , function ( assert ) {
4- assert . expect ( 23 ) ;
4+ assert . expect ( 24 ) ;
55
66 var params ;
77
@@ -72,6 +72,9 @@ QUnit.test( "jQuery.param()", function( assert ) {
7272
7373 params = { "test" : [ 1 , 2 , null ] } ;
7474 assert . equal ( jQuery . param ( params ) , "test%5B%5D=1&test%5B%5D=2&test%5B%5D=" , "object with array property with null value" ) ;
75+
76+ params = undefined ;
77+ assert . equal ( jQuery . param ( params ) , "" , "jQuery.param( undefined ) === empty string" ) ;
7578} ) ;
7679
7780QUnit . test ( "jQuery.param() not affected by ajaxSettings" , function ( assert ) {
You can’t perform that action at this time.
0 commit comments