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

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 UTC