Form#serializeElements should not serialize file inputs.
This commit is contained in:
parent
9787801f06
commit
6847d27509
|
@ -1,3 +1,5 @@
|
|||
* Form#serializeElements should not serialize file inputs. (kangax, Lonesome Boy)
|
||||
|
||||
* Fix an issue with calling Event.pointer before the DOM is loaded. (kangax, jddalton) [#4 state:resolved]
|
||||
|
||||
* Element#down on an input element should not raise error. (humeniuc, kangax)
|
||||
|
|
|
@ -12,7 +12,7 @@ var Form = {
|
|||
var data = elements.inject({ }, function(result, element) {
|
||||
if (!element.disabled && element.name) {
|
||||
key = element.name; value = $(element).getValue();
|
||||
if (value != null && (element.type != 'submit' || (!submitted &&
|
||||
if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
|
||||
submit !== false && (!submit || key == submit) && (submitted = true)))) {
|
||||
if (key in result) {
|
||||
// a key is already present; construct an array of values
|
||||
|
|
|
@ -79,6 +79,10 @@
|
|||
<input type="text" />
|
||||
</form>
|
||||
|
||||
<form id="form_with_file_input">
|
||||
<input type="file" name="file_name" value="foo" />
|
||||
</form>
|
||||
|
||||
<!-- tabindexed forms -->
|
||||
<div id="tabindex">
|
||||
<form id="ffe">
|
||||
|
|
|
@ -271,7 +271,9 @@ new Test.Unit.Runner({
|
|||
$('form').serialize({ submit: false }));
|
||||
this.assertHashEqual({ val1:4, action:'blah' },
|
||||
$('form').serialize({ submit: 'inexistent' }));
|
||||
|
||||
|
||||
// file input should not be serialized
|
||||
this.assertEqual('', $('form_with_file_input').serialize());
|
||||
},
|
||||
|
||||
testFormMethodsOnExtendedElements: function() {
|
||||
|
|
Loading…
Reference in New Issue