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:42:24 -0800
Message-ID: <255F83D0-8DA7-41CA-AD2E-347FFB145E3E@apple.com>

On Feb 18, 2010, at 8:36 PM, Tab Atkins Jr. wrote:

> On Thu, Feb 18, 2010 at 10:28 PM, Maciej Stachowiak <mjs at apple.com>  
> wrote:
>> 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;
>>  ...
>> };
> Jonas addressed that in the original email - he (rightfully, I feel)
> fears that if it's an attribute, people will assume that it can be
> assigned to.

There's lots of readonly attributes in the DOM. Are we worried about  
people trying to assign to Node.firstChild? NodeList.length?  
Event.target? Seems like a concern that is not borne out by experience.

Furthermore, making the attribute writable might even be useful. You  
could imagine saving the state of a form in client-side storage and  
wanting to restore it later while offline. Sure, you could extract the  
control values yourself and make up your own serialization format, but  
that seems like a waste when you have sweet tasty FormData.

> I see absolutely nothing wrong with 0-argument getters, personally.

I don't see the point, in a language that supports getter attributes.  
Why would you want to write form.getFormData() instead of  
form.formData? It's just a waste. I say save the parentheses for when  
there are either parameters or side effects rather than just getting a  

Received on Thursday, 18 February 2010 20:42:24 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:21 UTC