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

Avoid using extra markup via <template /> #3034

Closed
codev0 opened this issue Jun 17, 2019 · 1 comment
Closed

Avoid using extra markup via <template /> #3034

codev0 opened this issue Jun 17, 2019 · 1 comment

Comments

@codev0
Copy link

codev0 commented Jun 17, 2019

Hi there,
Why svelte doesn't support template tag?
I wanted to use them for avoiding extra markup with slots.
Please look to examples above,

With extra markup:

// Wrapper.svelte
<div>
	<slot name="content" />
</div>
<Wrapper>
	<div slot="content">
		Content
	</div>
</Wrapper>

With template tag for avoid extra markup:

<Wrapper>
	<template slot="content">
		Content
	</template>
</Wrapper>

Without extra markup, but with error 'slot' is reserved for future use in named slots

<Wrapper>
	<Field slot="content" />
</Wrapper>

REPL https://svelte.dev/repl/8ad8f71a5f5c48039d6be62e88ad07f8?version=3.5.1

By whatwg spec

The template element is used to declare fragments of HTML that can be cloned and inserted in the document by script.
In a rendering, the template element represents nothing.

@Conduitry
Copy link
Member

Duplicate of #2080. <template slot='foo'> is one of the syntaxes that was proposed in that ticket.

ALso slot as a prop name was specifically disallowed so that sometime in the future that last syntax could be added without it being a breaking change.

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

2 participants