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

On Dec 5, 2013, at 9:23 PM, Dimitri Glazkov <> wrote:
> On Thu, Dec 5, 2013 at 9:03 PM, Ryosuke Niwa <> wrote:
> On Dec 5, 2013, at 8:43 PM, Dimitri Glazkov <> wrote:
>> There were several threads around this in March/April, but the main gist is that we can't allow running user code when the parser is building the tree, and thus we would need to decouple the timing of the constructor being called from the [[Construct]] internal method to make constructors workable.
> That sounds like an implementation detail of Blink/WebKit.  Also, JS "wrappers" aren't even constructed immediately for builtin elements in WebKit and Blink so delaying the construction of elements until later time (e.g. end of micro task) seems fine.
> FWIW, the concern was brought up first by Microsoft's Tony Ross and then separately Mozilla's Jonas Sicking. Technically, both Blink and WebKit are capable of doing this. It's just mostly a terrible idea to interrupt tree construction with user code. Delaying construction of elements until end of microtask doesn't solve the problem -- you're just shifting the timing of tree construction.

I'm not suggesting to do that.  Simply call the constructor at when createdCallback is currently called.

- R. Niwa

Received on Friday, 6 December 2013 05:46:29 UTC