Skip to content

add important clarification to <template> #1283

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

Merged
merged 1 commit into from
Oct 19, 2021

Conversation

berzi
Copy link

@berzi berzi commented Oct 18, 2021

Description of Problem

<template> is used as a wrapper for conditional rendering of multiple elements, and as such is allowed to exist multiple times within a component, even a single-file one, but the top-level <template> tag must be only one.

Proposed Solution

By specifying that the constraint applies only to top-level instances of <template>, the ambiguity or possible confusion with the other use of the tag is avoided. Better alternatives to "top-level" could exist, but it's the most unambiguous term I could think of.

`<template>` is used as a wrapper for [conditional rendering](https://v3.vuejs.org/guide/conditional.html#conditional-groups-with-v-if-on-template) of multiple elements, and as such **is** allowed to exist multiple times within a component, even a single-file one, but the top-level `<template>` tag must be only one.
Copy link
Member

@NataliaTepluhina NataliaTepluhina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it's a nice addition indeed 👍🏻

@NataliaTepluhina NataliaTepluhina merged commit 9d9abfd into vuejs:master Oct 19, 2021
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

Successfully merging this pull request may close these issues.

2 participants