Re: Why can't we just use constructor instead of createdCallback?

On Fri, Feb 14, 2014 at 9:25 AM, Dimitri Glazkov <dglazkov@google.com> wrote:
> On Thu, Feb 13, 2014 at 6:50 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>>
>> Dimitri, I'd still love to hear feedback from you on the idea above.
>> Seems like it could fix one of the design issues that a lot of people
>> have reacted to.
>
>
> I am not sure I fully understand how this will work. Let me try to repeat it
> back and see if I got this right.
>
> Basically, we are modifying the tree construction algorithm to be a 3-pass
> system:
>
> 1) Build a meta tree (each node in the tree is a meta object that represents
> an element that will be constructed)
> 2) Instantiate all elements by calling constructors on them
> 3) Build the tree of elements from the meta tree.
>
> Right?

I'd rather put it as:

1) Construct the objects, but rather than inserting them in their
parents, remember which parent they should be inserted in.
2) Call constructors on all elements
3) Insert elements in their parent

So no need to construct any meta objects.

You can further optimize by only doing this for custom elements with a
constructor.

/ Jonas

Received on Friday, 14 February 2014 18:37:18 UTC