yapplabs / ember-wormhole

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

Support tagless wormholes #70

Open simonihmig opened 7 years ago

simonihmig commented 7 years ago

I was trying to create a tagless wormhole for not adding anything to the DOM where the wormhole is placed, like this: {{#ember-wormhole tagName="" to="..."}. This failed badly, both the wormholed content as well as I think the sibling nodes of the wormhole got screwed up badly.

I can try to bring up a more precise description of what the effect exactly is if needed, but it seems this just does not work at all. Without having looked too deeply into the implementation of ember-wormhole, I wonder is this known, or is there a good reason why this does not / cannot work?

I kind of feel like the wormhole should by tagless by default, or at least support this, because when you do not want to have your wormholed content to sit in the DOM where it logically belongs to (which is why you use the wormhole in the first place, right?), then you also do not want an empty, "orphaned" div to hang around. With some "loose" CSS selectors this empty div could actually get some styling applied and thus become visible.

If this use case has been overlooked so far, I might try to bring up a PR when I find the time...

Apart from that, this addon has been so useful in so many cases! 👍

lukemelia commented 7 years ago

@krisselden should this be possible?

urbany commented 7 years ago

I also wanted to know if this was possible. Any update on this @lukemelia ? If not possible, maybe the default tagName should be span so it isn't an element with display: block.

lukemelia commented 7 years ago

@urbany I haven't had time to look into this and don't have any short-term plans to do so. Happy for someone else to dig in, though.

simonihmig commented 7 years ago

@lukemelia maybe I can try to do that...

However I wonder if there is some kind of major rewrite of ember-wormhole pending that would make tweaks like that obsolete? I am just guessing because of the other issue I filed (#66) and the PR (https://github.com/tildeio/glimmer/pull/331) that provided a better integration for Glimmer2.

If I understand correctly that better Glimmer2 integration has not been done yet, right? Would that support the tagless use case better, or even solve it naturally?

Just don't want to loose time on a very short term interim fix...

lukemelia commented 7 years ago

There is work in progress for Glimmer2, most recently https://github.com/yapplabs/ember-wormhole/pull/75. @krisselden & @rwjblue may be able to provide more context as it relates to your possibly work.

simonihmig commented 7 years ago

Yeah, I have seen this PR already, but it seems to have tackled some other problem. Not the new integration hook provided for Glimmer2 (the #-in-element thing). That is also already in the works?

lukemelia commented 7 years ago

@simonihmig the in-element thing was worked on by @runspired but he discovered that the API was not yet sufficient to support wormhole's semantics.