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

If condition in default slot or try mount to empty fragment #822

Closed
stalkerg opened this issue Sep 6, 2017 · 2 comments · Fixed by #835
Closed

If condition in default slot or try mount to empty fragment #822

stalkerg opened this issue Sep 6, 2017 · 2 comments · Fixed by #835
Labels

Comments

@stalkerg
Copy link
Contributor

stalkerg commented Sep 6, 2017

First - example:
https://svelte.technology/repl?version=1.37.0&gist=77279f780755dcecd28eb8899a08e22d
and working one:
https://svelte.technology/repl?version=1.31.0&gist=77279f780755dcecd28eb8899a08e22d

it's happening because Svelte generates next code:

if_block = create_if_block( state, component );
if_block.create();
if_block.mount( modal._slotted.default, null );

but modal._slotted.default it's just empty fragment because in the _fragment you did:

if (slot_content_default) {
  appendNode(slot_content_default, div_1);
}

then slot_content_default it is our modal._slotted.default .

Anyway, we can't mount to slot we should find existent dom element for that.
Example with cycle "each" don't work at all:
https://svelte.technology/repl?version=1.37.0&gist=70649b67d9f75bc91f3cc5c883b2c9e5

@stalkerg
Copy link
Contributor Author

stalkerg commented Sep 6, 2017

Wraparound - add root div element around all "slot" content.
It will be like:

if_block.mount( div, null );

@Rich-Harris
Copy link
Member

This is fixed in 1.39.1 — thanks

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

Successfully merging a pull request may close this issue.

2 participants