W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: Element.create(): a proposal for more convenient element creation

From: Charles Pritchard <chuck@jumis.com>
Date: Mon, 1 Aug 2011 23:25:23 -0700
Message-Id: <A74795E0-60FD-4D38-AA44-C3F4E5F6C22A@jumis.com>
Cc: João Eiras <joao.eiras@gmail.com>, WebApps WG <public-webapps@w3.org>
To: Ian Hickson <ian@hixie.ch>
On Aug 1, 2011, at 9:25 PM, Ian Hickson <ian@hixie.ch> wrote:

> On Tue, 2 Aug 2011, João Eiras wrote:
>> 
>> While the idea is interesting, "create" is a too simple name to add on 
>> something as polluted as Element.
> 
> Why?
> 
> I think create() is fine. It's a pretty common name for a factory or 
> constructor (in languages with named constructors), and having it on the 
> interface object makes it pretty clear what it's a factory for.


If we can get this chained, the .attr({key:val}) syntax is handy at times, too, if / when applied to existing items.

At that point, it's very similar to the popular helpers out there, esp, jQuery. One nice aspect of that is that those package maintainers can feature test for the native model, even if it's a long-name to type. Might slightly (very slightly) improve performance in such code bases.
Received on Tuesday, 2 August 2011 06:26:11 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:46 GMT