Skip to content

Conversation

@codders
Copy link
Contributor

@codders codders commented Jul 15, 2025

Sometimes it is useful to be able to iterate in a template without adding additional levels of HTML nesting to the DOM. Vue supports iterating with v-for attributes on template elements for this use case.

Add support for v-for loops with template tags.

Bug: T396098

@codders codders requested a review from lucaswerkmeister July 15, 2025 11:03
Copy link
Member

@lucaswerkmeister lucaswerkmeister left a comment

Choose a reason for hiding this comment

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

I feel like it should be possible to put the “replace <template> with its children” step somewhere else where it’ll also work for v-if on <template> (near the end of handleNode()?). But we can do that when it becomes necessary.

Sometimes it is useful to be able to iterate in a template without
adding additional levels of HTML nesting to the DOM. Vue supports
iterating with `v-for` attributes on `template` elements for this
use case.

Add support for `v-for` loops with `template` tags.

Bug: T396098
@codders codders force-pushed the feat/support-template-v-for-20250715 branch from a039aac to 28ce02a Compare July 16, 2025 07:26
@codders
Copy link
Contributor Author

codders commented Jul 16, 2025

I feel like it should be possible to put the “replace <template> with its children” step somewhere else where it’ll also work for v-if on <template> (near the end of handleNode()?). But we can do that when it becomes necessary.

I had a bit of a play with doing that but couldn't easily find the right place for it. Happy to look at that again when we introduce the feature.

Copy link
Contributor

@yerdua yerdua left a comment

Choose a reason for hiding this comment

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

lgtm

@yerdua yerdua merged commit f866348 into master Jul 16, 2025
8 checks passed
@yerdua yerdua deleted the feat/support-template-v-for-20250715 branch July 16, 2025 14:01
@codders codders restored the feat/support-template-v-for-20250715 branch July 17, 2025 10:49
@codders codders deleted the feat/support-template-v-for-20250715 branch July 17, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants