File tree Expand file tree Collapse file tree 3 files changed +0
-49
lines changed Expand file tree Collapse file tree 3 files changed +0
-49
lines changed Original file line number Diff line number Diff line change @@ -265,35 +265,6 @@ describe('compiler: v-for', () => {
265
265
)
266
266
} )
267
267
268
- test ( '<template v-for> key placement' , ( ) => {
269
- const onError = jest . fn ( )
270
- parseWithForTransform (
271
- `
272
- <template v-for="item in items">
273
- <div :key="item.id"/>
274
- </template>` ,
275
- { onError }
276
- )
277
-
278
- expect ( onError ) . toHaveBeenCalledTimes ( 1 )
279
- expect ( onError ) . toHaveBeenCalledWith (
280
- expect . objectContaining ( {
281
- code : ErrorCodes . X_V_FOR_TEMPLATE_KEY_PLACEMENT
282
- } )
283
- )
284
-
285
- // should not warn on nested v-for keys
286
- parseWithForTransform (
287
- `
288
- <template v-for="item in items">
289
- <div v-for="c in item.children" :key="c.id"/>
290
- </template>` ,
291
- { onError }
292
- )
293
- expect ( onError ) . toHaveBeenCalledTimes ( 1 )
294
- } )
295
- } )
296
-
297
268
describe ( 'source location' , ( ) => {
298
269
test ( 'value & source' , ( ) => {
299
270
const source = '<span v-for="item in items" />'
Original file line number Diff line number Diff line change @@ -76,7 +76,6 @@ export const enum ErrorCodes {
76
76
X_V_ELSE_NO_ADJACENT_IF ,
77
77
X_V_FOR_NO_EXPRESSION ,
78
78
X_V_FOR_MALFORMED_EXPRESSION ,
79
- X_V_FOR_TEMPLATE_KEY_PLACEMENT ,
80
79
X_V_BIND_NO_EXPRESSION ,
81
80
X_V_ON_NO_EXPRESSION ,
82
81
X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET ,
@@ -152,7 +151,6 @@ export const errorMessages: Record<ErrorCodes, string> = {
152
151
[ ErrorCodes . X_V_ELSE_NO_ADJACENT_IF ] : `v-else/v-else-if has no adjacent v-if or v-else-if.` ,
153
152
[ ErrorCodes . X_V_FOR_NO_EXPRESSION ] : `v-for is missing expression.` ,
154
153
[ ErrorCodes . X_V_FOR_MALFORMED_EXPRESSION ] : `v-for has invalid expression.` ,
155
- [ ErrorCodes . X_V_FOR_TEMPLATE_KEY_PLACEMENT ] : `<template v-for> key should be placed on the <template> tag.` ,
156
154
[ ErrorCodes . X_V_BIND_NO_EXPRESSION ] : `v-bind is missing expression.` ,
157
155
[ ErrorCodes . X_V_ON_NO_EXPRESSION ] : `v-on is missing expression.` ,
158
156
[ ErrorCodes . X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET ] : `Unexpected custom directive on <slot> outlet.` ,
Original file line number Diff line number Diff line change @@ -117,24 +117,6 @@ export const transformFor = createStructuralDirectiveTransform(
117
117
let childBlock : BlockCodegenNode
118
118
const { children } = forNode
119
119
120
- // check <template v-for> key placement
121
- if ( ( __DEV__ || ! __BROWSER__ ) && isTemplate ) {
122
- node . children . some ( c => {
123
- if ( c . type === NodeTypes . ELEMENT ) {
124
- const key = findProp ( c , 'key' )
125
- if ( key ) {
126
- context . onError (
127
- createCompilerError (
128
- ErrorCodes . X_V_FOR_TEMPLATE_KEY_PLACEMENT ,
129
- key . loc
130
- )
131
- )
132
- return true
133
- }
134
- }
135
- } )
136
- }
137
-
138
120
const needFragmentWrapper =
139
121
children . length !== 1 || children [ 0 ] . type !== NodeTypes . ELEMENT
140
122
const slotOutlet = isSlotOutlet ( node )
You can’t perform that action at this time.
0 commit comments