- From: Dimitri Glazkov <dglazkov@chromium.org>
- Date: Tue, 2 Aug 2011 11:02:23 -0700
- To: Ian Hickson <ian@hixie.ch>
- Cc: WebApps WG <public-webapps@w3.org>
On Tue, Aug 2, 2011 at 10:37 AM, Ian Hickson <ian@hixie.ch> wrote: > 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. We should have a good discussion about whether we should be aiming to subclass/extend DOM elements. Though in this particular context, graceful degradation is a useless concept: you're building DOM imperatively using APIs that haven't even yet even been invented properly. :DG<
Received on Tuesday, 2 August 2011 18:02:48 UTC