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

Block elements inside p cause rehydration failures #249

Open
aghassemi opened this issue Nov 1, 2019 · 2 comments
Open

Block elements inside p cause rehydration failures #249

aghassemi opened this issue Nov 1, 2019 · 2 comments

Comments

@aghassemi
Copy link

Example:
<p> <div> foo </div> </p>

Browser close p when seeing a block element inside, so, for example above, they end up creating a DOM that matches <p></p> <div></div> instead.

I suspect Simple DOM used in Fastboot does not behave the same, this results in rehydration markers getting messed up and ends with rehydration errors on the client side halting the whole app.

/cc @krisselden @rwjblue

@rwjblue
Copy link
Member

rwjblue commented Nov 1, 2019

Unfortunately, this isn't really a bug here in fastboot, generally speaking we can't autocorrect every form of invalid HTML (where the browser does a correction)...

We should be linting against using block level elements within a <p> when they occur within a single template (e.g. not due to component invocation), and the rehydration system should properly clear the invalid / unknown contents of the <p> and resume rehydrating.

@st-h
Copy link

st-h commented Sep 12, 2020

Thanks for keeping this open. Just wondered why the fastboot render would lead to different output than the browser rendered version. Just learned that putting a <div> into a <p> element actually is invalid syntax 🤦‍♂️

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

No branches or pull requests

4 participants