W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] Adding FormData support to <form>

From: Maciej Stachowiak <mjs@apple.com>
Date: Thu, 18 Feb 2010 20:28:47 -0800
Message-ID: <41164555-9F9E-4E40-A1E4-0D8639D09C90@apple.com>

On Feb 18, 2010, at 2:06 PM, Jonas Sicking wrote:

> On Wed, Feb 17, 2010 at 11:30 PM, Anne van Kesteren  
> <annevk at opera.com> wrote:
>> On Thu, 18 Feb 2010 00:15:25 +0100, Jonas Sicking  
>> <jonas at sicking.cc> wrote:
>>>
>>> So I suggest we add a method like
>>>
>>> interface HTMLFormElement : HTMLElement {
>>>  ...
>>>  FormData getFormData();
>>>  ...
>>> };
>>
>> Should we name it toFormData() instead for consistency with  
>> <canvas>? Or is
>> <canvas> inconsistent with something else?
>
> There are much more functions that are named "getX" than "toX" in the
> DOM. Such as getElementById, getElementsByTagName,
> getBoundingClientRect.

I agree. toFoo implies a mere conversion. But getting the FormData is  
not just a type conversion.

However, I also think 0-argument getters are a bad pattern in  
JavaScript. Why not just use an attribute?

interface HTMLFormElement : HTMLElement {
  ...
  readonly attribute FormData formData;
  ...
};

Regards,
Maciej
Received on Thursday, 18 February 2010 20:28:47 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:55 UTC