[whatwg] Adding FormData support to <form>

Maciej Stachowiak mjs at apple.com
Thu Feb 18 20:45:28 PST 2010


On Feb 17, 2010, at 3:15 PM, Jonas Sicking wrote:

> The reason this is a function rather than a read-only attribute is to
> allow the return FormData to be further modified. I.e. the following
> should be allowed:
>
> fd = myFormElement.getFormData();
> fd.append("foo", "bar");
> xhr.send(fd);
>
> If it was a property I would be worried about people expecting the
> following to work:
> myFormElement.formData.append("foo", "bar");
> xhr.send(myFormElement.formData);
>
> However I don't think there is a good way to make the above work. Thus
> my suggestion to use a function instead. I'm writing a prototype
> implementation over in [2]

People could imagine that this should work:

myFormElement.getFormData().append("foo", "bar");
xhr.send(myFormElement.getFormData());

In either case, it seems that once they see it doesn't work, they will  
no longer expect it to work.

Regards,
Maciej




More information about the whatwg mailing list