Describe the bug
When constructing a FormData instance from an HTMLFormElement containing an input that has both an idand a name, the input's value appears twice in the form data.
To Reproduce
describe('FormData', () => {
describe('Constructor', () => {
it('Contains the value of named inputs with ids only once', () => {
const form = document.createElement('form');
const input = document.createElement('input');
input.name = 'inputName';
input.id = 'inputId';
input.value = 'testing';
form.appendChild(input);
const formData = new window.FormData(form);
expect(formData.getAll('inputName')).toEqual(['testing']);
});
});
});
Expected behavior
The resulting formData should only have a single value for the inputName key.
Calling formData.getAll('inputName') returns ['testing'].
Current behavior
Calling formData.getAll('inputName') returns ['testing', 'testing'].
Describe the bug When constructing a
FormData
instance from anHTMLFormElement
containing an input that has both anid
and aname
, the input's value appears twice in the form data.To Reproduce
Expected behavior The resulting
formData
should only have a single value for theinputName
key. CallingformData.getAll('inputName')
returns['testing']
.Current behavior Calling
formData.getAll('inputName')
returns['testing', 'testing']
.Device: