diff options
author | Timmy Willison <4timmywil@gmail.com> | 2018-06-20 12:07:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-20 12:07:44 -0400 |
commit | 0645099e027cd0e31a828572169a8c25474e2b5c (patch) | |
tree | 27fd4dd921e34a5962607a53c7c1a00c29bebfd9 /src | |
parent | 4f3b8f0d0bd2b02960a42e64be0dcbf8073c94bb (diff) | |
download | jquery-0645099e027cd0e31a828572169a8c25474e2b5c.tar.gz jquery-0645099e027cd0e31a828572169a8c25474e2b5c.zip |
Serialize: jQuery.param: return empty string when given null/undefined
Fixes gh-2633
Close gh-4108
Diffstat (limited to 'src')
-rw-r--r-- | src/serialize.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/serialize.js b/src/serialize.js index 30fcf98cc..44d3606b3 100644 --- a/src/serialize.js +++ b/src/serialize.js @@ -70,6 +70,10 @@ jQuery.param = function( a, traditional ) { encodeURIComponent( value == null ? "" : value ); }; + if ( a == null ) { + return ""; + } + // If an array was passed in, assume that it is an array of form elements. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { |