From 0645099e027cd0e31a828572169a8c25474e2b5c Mon Sep 17 00:00:00 2001 From: Timmy Willison <4timmywil@gmail.com> Date: Wed, 20 Jun 2018 12:07:44 -0400 Subject: Serialize: jQuery.param: return empty string when given null/undefined Fixes gh-2633 Close gh-4108 --- src/serialize.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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 ) ) ) { -- cgit v1.2.3