crysalead-js / dom-layer

Virtual DOM implementation.
MIT License
30 stars 1 forks source link

Tag's created hook should always run after insertion in the DOM #72

Closed brandonpayton closed 7 years ago

brandonpayton commented 8 years ago

Tag's created hook is called inconsistently relative to when its element is inserted in the DOM.

I don't have a strong idea how this should be fixed in the current implementation. Since you likely want to do child insertions before the parent is added to the DOM, I believe you will have to walk the tree to render, insert the parent in the DOM, and then walk the tree again to fire created hooks.

jails commented 8 years ago

Hmm I'll need to think about it a bit.

jails commented 7 years ago

Fixed in https://github.com/crysalead-js/dom-layer/commit/88ff26d5bc82730c495c96dcf679261263cf54ad

The 'created' hook is triggered while the dom element is created while the 'inserted' is triggered while the dom element has been actually inserted in the DOM.