Skip to content
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

Produces Invalid HTML if wrapped in a <p> tag - source of hydration issues with SSR #53

Open
TuringJest opened this issue Feb 24, 2021 · 3 comments

Comments

@TuringJest
Copy link

TuringJest commented Feb 24, 2021

Using v-clamp inside a <p> tag will generate invalid HTML as v-clamp will put a div wrapper around the text.
In NUXT this will lead to hydration problems with SSR rendering even when the plugin is configured to ssr: false.

Why not use another span? Or add an option to choose the wrapper tag?

@jibsaramnim
Copy link
Contributor

@TuringJest not the creator, but thought I'd chime in; there's already built-in functionality for this with a string property called tag. I think that's what you're looking for, right?

@TuringJest
Copy link
Author

@jibsaramnim thanks for commenting. If I remember it correctly that didn't work because v-clamp will still render a div somewhere inside that tag. Unfortunately, if using <p> any <div> that appears somewhere nested will be invalid HTML and break NUXT's hydration.

@jibsaramnim
Copy link
Contributor

@TuringJest oh really, that's odd. I just did a quick test on my end by placing a v-clamp inside a <p> and it seems to work without adding any div elements if I specify tag="span", I only see three span child-elements in the DOM. Sorry I can't be of more help :(.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants