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

On 1/10/14 11:10 AM, Erik Arvidsson wrote:
> 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.

For spec purposes and parser implementation design purposes that doesn't 
matter.  If user code can be called, the algorithms involved have to 
handle user code being called at that point and potentially tearing the 
world down (or apart, or just rearranging it in macabre ways like user 
code tends to do)...

> 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.

Yeah, agreed.

-Boris

Received on Friday, 10 January 2014 16:17:22 UTC