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

{{Yield}} content isn't injected in the correct place #561

Closed
tomcon opened this issue May 4, 2017 · 3 comments
Closed

{{Yield}} content isn't injected in the correct place #561

tomcon opened this issue May 4, 2017 · 3 comments
Labels

Comments

@tomcon
Copy link

tomcon commented May 4, 2017

per docs https://svelte.technology/guide#yield-tags:
The button below appears above the yielded content instead of below it

<div class='modal'>
  {{yield}} <!-- content is injected here -->
  <button on:click='destroy()'>close modal</button>
</div>
@Conduitry Conduitry added the bug label May 4, 2017
@Conduitry
Copy link
Member

This looks related to the changes in 1.18.0 for #3. It's a bit hard to tell what's going on the in REPL because there seem to be some other bugs in the REPL surfacing as I look at this. But I'm fairly certain the code being generated is actually wrong. The code creates the div and places the button in it:

	var div_1 = createElement( 'div' );
	setAttribute( div_1, 'svelte-2785217407', '' );
	div_1.className = "modal";
	appendNode( createText( " \n\t" ), div_1 );
	var button = createElement( 'button' );
	appendNode( button, div_1 );

and then later mounts the {{yield}}ed component to that same div.

			component._yield && component._yield.mount( div_1, null );

Things look okay if you wrap the {{yield}} in its own div, as we're then mounting the {{yield}}ed component to that div.

@Conduitry
Copy link
Member

This looks like the change at fault. If the {{yield}} isn't the last sibling in its parent node, I don't see how we can get away without anchors here.

Rich-Harris added a commit that referenced this issue May 4, 2017
@Rich-Harris
Copy link
Member

Mea culpa! Am toying around with this though and I think we might still be able to do it without anchors... will report back

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

No branches or pull requests

3 participants