@@ -60,6 +60,9 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
6060 // element
6161 // generate the template literal representing the open tag.
6262 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
6366
6467 // v-bind="obj" or v-bind:[key] can potentially overwrite other static
6568 // attrs and can affect final rendering result, so when they are present
@@ -79,10 +82,12 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
7982 // assign the merged props to a temp variable, and check whether
8083 // it contains value (if yes, render is as children).
8184 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+ ]
8691 const existingText = node . children [ 0 ] as TextNode | undefined
8792 rawChildrenMap . set (
8893 node ,
@@ -125,6 +130,10 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
125130 }
126131 }
127132
133+ if ( needTagForRuntime ) {
134+ propsExp . arguments . push ( `"${ node . tag } "` )
135+ }
136+
128137 openTag . push ( propsExp )
129138 }
130139 }
@@ -234,10 +243,14 @@ export const ssrTransformElement: NodeTransform = (node, context) => {
234243 // dynamic key attr
235244 // this branch is only encountered for custom directive
236245 // transforms that returns properties with dynamic keys
246+ const args : CallExpression [ 'arguments' ] = [ key , value ]
247+ if ( needTagForRuntime ) {
248+ args . push ( `"${ node . tag } "` )
249+ }
237250 openTag . push (
238251 createCallExpression (
239252 context . helper ( SSR_RENDER_DYNAMIC_ATTR ) ,
240- [ key , value ]
253+ args
241254 )
242255 )
243256 }
0 commit comments