-
-
Notifications
You must be signed in to change notification settings - Fork 135
Parsing a file with CRLF End-of-Lines creates unwanted __html_dom_parser_carriage_return_placeholder_ tags
and breaks NextJS hydration
#1755
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
Comments
__html_dom_parser_carriage_return_placeholder_ tags
and breaks NextJS hydration
@olivierr91 thanks for creating this issue. I'm unable to reproduce the bug that you're seeing: https://stackblitz.com/edit/html-react-parser-1755?file=src%2Findex.tsx Just checking, is your SVG valid? |
@remarkablemark here is a complete component code that will reproduce the issue. Note that this issue only happens when using the
Please note the carriage return Yes, this is a valid SVG. It can be validated here (after unescaping the end-of-line characters): https://validator.w3.org/check |
@olivierr91 yes this library uses separate client and server HTML parsers. Are you able to replace |
@remarkablemark Yes, that is the workaround I have done. But I feel it's a bug that should be fixed. What is the library used client-side? I will open an issue directly with them. |
See html-dom-parser This may be related to remarkablemark/html-dom-parser#902 and remarkablemark/html-dom-parser#923 |
Expected Behavior
End-of-lines with CRLF or CR should be recognized and treated properly.
Actual Behavior
When parsing HTML string containing CRLF end-of-lines, invalid tags with name
_html_dom_parser_carriage_return_placeholder_<random-number>_
are created, causing the HTML to not display properly, and also causing NextJS to fail hydration.Steps to Reproduce
parse()
Reproducible Demo
Will provide if needed. But the problem here is probably faster to spot in your codebase than for me to write a demo.
Environment
The text was updated successfully, but these errors were encountered: