Skip to content

Commit d65747a

Browse files
committed
fix(TransitionGroup): filter private props to avoid invalid HTML attributes
- Add filtering for `name` prop in SSR transform logic - Prevents `name` from being rendered as DOM attribute (e.g. `<ul name="list">`) - Fixes #13037 (invalid HTML from TransitionGroup with custom `tag`) Ensures only valid HTML attributes are passed to the rendered element, resolving W3C validation issues.
1 parent ba3ac8a commit d65747a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/compiler-ssr/src/transforms/ssrTransformTransitionGroup.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ export function ssrTransformTransitionGroup(
3232
return (): void => {
3333
const tag = findProp(node, 'tag')
3434
if (tag) {
35-
const otherProps = node.props.filter(p => p !== tag)
35+
// 在处理 TransitionGroup 的属性时,过滤掉 name/tag 等私有 props
36+
const otherProps = node.props.filter(p => {
37+
// 排除 tag(已单独处理)和 name(私有 props,不该透传)
38+
if (
39+
p === tag ||
40+
(p.type === NodeTypes.ATTRIBUTE && p.name === 'name')
41+
) {
42+
return false
43+
}
44+
return true
45+
})
3646
const { props, directives } = buildProps(
3747
node,
3848
context,

0 commit comments

Comments
 (0)