@@ -60,6 +60,9 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
60
60
// element
61
61
// generate the template literal representing the open tag.
62
62
const openTag : TemplateLiteral [ 'elements' ] = [ `<${ node . tag } ` ]
63
+ // some tags need to be pasesd to runtime for special checks
64
+ const needTagForRuntime =
65
+ node . tag === 'textarea' || node . tag . indexOf ( '-' ) > 0
63
66
64
67
// v-bind="obj" or v-bind:[key] can potentially overwrite other static
65
68
// attrs and can affect final rendering result, so when they are present
@@ -79,10 +82,12 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
79
82
// assign the merged props to a temp variable, and check whether
80
83
// it contains value (if yes, render is as children).
81
84
const tempId = `_temp${ context . temps ++ } `
82
- propsExp . arguments [ 0 ] = createAssignmentExpression (
83
- createSimpleExpression ( tempId , false ) ,
84
- props
85
- )
85
+ propsExp . arguments = [
86
+ createAssignmentExpression (
87
+ createSimpleExpression ( tempId , false ) ,
88
+ props
89
+ )
90
+ ]
86
91
const existingText = node . children [ 0 ] as TextNode | undefined
87
92
rawChildrenMap . set (
88
93
node ,
@@ -125,6 +130,10 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
125
130
}
126
131
}
127
132
133
+ if ( needTagForRuntime ) {
134
+ propsExp . arguments . push ( `"${ node . tag } "` )
135
+ }
136
+
128
137
openTag . push ( propsExp )
129
138
}
130
139
}
@@ -234,10 +243,14 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
234
243
// dynamic key attr
235
244
// this branch is only encountered for custom directive
236
245
// transforms that returns properties with dynamic keys
246
+ const args : CallExpression [ 'arguments' ] = [ key , value ]
247
+ if ( needTagForRuntime ) {
248
+ args . push ( `"${ node . tag } "` )
249
+ }
237
250
openTag . push (
238
251
createCallExpression (
239
252
context . helper ( SSR_RENDER_DYNAMIC_ATTR ) ,
240
- [ key , value ]
253
+ args
241
254
)
242
255
)
243
256
}
0 commit comments