-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dx(compiler-dom): warn on invalid html nesting #10734
Conversation
Size ReportBundles
Usages
|
h4: headings, | ||
h5: headings, | ||
h6: headings, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation seems a bit oversimplified which will miss mismatches like p > a > div
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, but there's currently no way to retrieve ancestor nodes.
core/packages/compiler-core/src/transform.ts
Lines 104 to 107 in f8eba75
parent: ParentNode | null | |
// we could use a stack but in practice we've only ever needed two layers up | |
// so this is more efficient | |
grandParent: ParentNode | null |
Related issue: #12088 |
According to the HTML spec,
<p><div></div></p>
is not a valid syntax. However, it functions when utilizing the JS DOM API. Consequently, it operates effectively in Vue runtime but fails with SSR. So I introduced this warning on dev mode.SSR Demo