Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append to a not empty element? #34

Open
FezVrasta opened this issue Sep 16, 2015 · 3 comments
Open

Append to a not empty element? #34

FezVrasta opened this issue Sep 16, 2015 · 3 comments

Comments

@FezVrasta
Copy link

Looks like I can't set as wormhole endpoint an element with already some nodes inside. Why that? Is there any workaround?

Thanks.

@timmyomahony
Copy link

timmyomahony commented Jul 19, 2016

+1 For example, I have a mobile nav hamburger that I want to display within my wormhole destination unless there is active content in the wormhole:

<div id="nav-icon">
    <img ... />
</div>

so ideally when I use {{#ember-wormhold to="nav-icon"}}<img class="new-button" ... />{{/ember-wormhole}} it would overwrite instead of append.

Maybe an option such as {{#ember-wormhold to="nav-icon" replace=true}}?

@Kerrick
Copy link

Kerrick commented Nov 14, 2016

I have a similar desire, I'd like to have some "skeleton UI" that shows up in my wormhole destination until the wormhole renders, and I'd love for ember-wormhole to clear out the destination element before rendering there.

Here's a reduced example:

<div id="open-graph-share">
    <a class="facebook">Share</a>
    <a class="pinterest">Pin It</a>
    <a class="twitter">Tweet</a>
</div>
{{#if socialSDKsAreLoaded}}
  {{#ember-wormhole to="open-graph-share"}}
    <a class="facebook" {{action "share"}}>Share</a>
    <a class="pinterest" {{action "pin"}}>Pin It</a>
    <a class="twitter" {{action "tweet"}}>Tweet</a>
  {{/ember-wormhole}}
{{/if}}

I'd be perfectly happy with a replace=true attr.

@lukemelia
Copy link
Contributor

An attempt was made to implement this but ultimately abandoned due to tricky semantics. If anyone wants to dig further, you will want to review #52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants