Caveats
We are waiting on a fix for issue 43394, "DOM attributes should be moved to prototype chains and should expose JavaScript getters and setters". Until it fixes, spirits will attach async in Chrome and Safari whenever one of these is involved:
innerHTML
outerHTML
textContent
The bug relates to these things being implemented as property setters instead of method calls. Observe the difference:
document.body.textContent = 'hello'; // property setter
document.body.appendChild(textnode); // method call
We can work around this with a MutationObserver
. When the DOM changes, the observer will trigger a spiritualization of newly created elements.
- Spirits will constructed as expected, it just takes a few milliseconds before it happens. Until the bug is fixed, please be aware of this potential delay while coding your spirits.
- Spirits may however not be destructed properly when their element is removed from the DOM, so they may still be subscribed to events and broadcasts going on. If this causes problems, you'll need extra code to work around it.
The issue is making good progress in Chrome but the status in Safari is unknown, as always.