On Dec 5, 2013, at 8:43 PM, Dimitri Glazkov <[email protected]> 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.
> But then they aren't constructors, but callbacks, since the object would
> already be exist (and be in a tree). So we decided to not lie and just call
> them callbacks, rather than constructors.
It would be extremely unfortunate if authors can't use constructor() in the
world we have ES6 classes.
class MyButtonElement extends HTMLElement {
constructor() {
...
}
}
looks much more natural than
class MyButtonElement extends HTMLElement {
constructor() {
// Would I ever be called? If so, when? Is that safe?
}
createdCallback() {
...
}
}
> http://lists.w3.org/Archives/Public/public-webapps/2013JanMar/0728.html
> http://lists.w3.org/Archives/Public/public-webapps/2013AprJun/thread.html#msg152
> I am probably forgetting some…
Thanks for the pointers again.
- R. Niwa