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

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

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 2 Aug 2011 17:37:44 +0000 (UTC)
To: Dimitri Glazkov <dglazkov@chromium.org>
cc: WebApps WG <public-webapps@w3.org>
Message-ID: <Pine.LNX.4.64.1108021736181.18680@ps20323.dreamhostps.com>
On Tue, 2 Aug 2011, Dimitri Glazkov wrote:
> On Tue, Aug 2, 2011 at 1:27 AM, Roland Steiner 
> <rolandsteiner@google.com> wrote:
> > On Tue, Aug 2, 2011 at 4:36 PM, Jonas Sicking <jonas@sicking.cc> 
> > wrote:
> >> This doesn't explain why a factory method is better than explicit 
> >> constructors though? The above could be written as
> >>
> >> new HTMLParagraphElement(null, "foo", ...);
> >
> > It's not a general use case, but at least when it comes to XBL-like 
> > components, having a factory method that does all the lookup and 
> > binding behing the scenes probably is easier to implement than hooking 
> > a constructor (FWIW).
> 
> I am not sure it will be easier but it does seem that it would be more 
> natural to an author to write:
> 
> var foo = new FooButton();
> 
> than:
> 
> var foo = Element.create('x-foo-button').

One of the principles behind XB2L's design was graceful degradation, such 
that sites would still mostly work without the bindings being applies. It 
seems that if we're creating proprietary elements, that won't work. So I'm 
not sure this is a use case we should be addressing.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 2 August 2011 17:38:16 GMT

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