yapplabs / ember-wormhole

Render a child view somewhere else in the DOM.
MIT License
284 stars 62 forks source link

Keeping children in destination element #92

Open roelrz opened 7 years ago

roelrz commented 7 years ago

According to the docs, if a wormhole is used on a route's template it will render it's children in the destination element when the route is rendered and removed when the route is exited.

With that being said, is there any way to keep the children in the destination element even after the route is exited?

My use case is to update the destination element every time a route changes but to keep the route's children in the destination element until the new route's children are ready to be injected via the wormhole

krisselden commented 7 years ago

@roelrz there is no supported way, you can lobby for this feature and/or submit a PR. Currently you can leak the DOM nodes by this._wormholeHeadNode.parentNode.insertBefore(this._wormholeHeadNode, this._wormholeTailNode) in willDestroyElement, or use cloneNode(true) on the node you want to keep.