aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2013-01-23 12:23:46 -0500
committerTimmy Willison <timmywillisn@gmail.com>2013-01-23 12:23:46 -0500
commitcaac041fcc31724b8b579939e8053966559483ca (patch)
tree02825910087f8ed146b4d1a180aa3c4cd45d66ff
parentb326225d9087ee8c5648ace3cf88feab0330353d (diff)
downloadjquery-caac041fcc31724b8b579939e8053966559483ca.tar.gz
jquery-caac041fcc31724b8b579939e8053966559483ca.zip
Ignore file inputs when serializing forms. File input serialization is handled by plugins. Fixes #13306.
-rw-r--r--src/serialize.js2
-rw-r--r--test/unit/serialize.js5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/serialize.js b/src/serialize.js
index 6e8353d59..65dee4005 100644
--- a/src/serialize.js
+++ b/src/serialize.js
@@ -1,7 +1,7 @@
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
- rsubmitterTypes = /^(?:submit|button|image|reset)$/i,
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
jQuery.fn.extend({
diff --git a/test/unit/serialize.js b/test/unit/serialize.js
index ab5d1c427..eff2a0086 100644
--- a/test/unit/serialize.js
+++ b/test/unit/serialize.js
@@ -112,8 +112,9 @@ test("serialize()", function() {
// Add html5 elements only for serialize because selector can't yet find them on non-html5 browsers
jQuery("#search").after(
- "<input type='email' id='html5email' name='email' value='dave@jquery.com' />"+
- "<input type='number' id='html5number' name='number' value='43' />"
+ "<input type='email' id='html5email' name='email' value='dave@jquery.com' />" +
+ "<input type='number' id='html5number' name='number' value='43' />" +
+ "<input type='file' name='fileupload' />"
);
equal( jQuery("#form").serialize(),