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

On Thu, Jan 9, 2014 at 10:57 PM, Ryosuke Niwa <rniwa@apple.com> wrote:

> > 1. The parser does not know that it needs to use MyElement.@@create to
> create the JS objects when it sees a <my-element>.
>
> On the other hand, solving this seems to require running some author
> scripts at the element creation time, at some later time but before the
> node is inserted into the document.


My hope was that it would be rare to override Symbol.create for Elements so
in most cases we would not need to call user code.

After further discussing this with Dominic and others I've given up the
hope that an object instance cannot be reached before the constructor has
been called. This can happen due to navigating the DOM tree but also be
manually calling `MyCustomElement[Symbol.create]()`. At this point I
believe we should just resolve to best practice and that is to not use
@@create directly and do not navigate the DOM tree in your constructors.


-- 
erik

Received on Friday, 10 January 2014 16:11:46 UTC