Skip to content

Parsing a file with CRLF End-of-Lines creates unwanted __html_dom_parser_carriage_return_placeholder_ tags and breaks NextJS hydration #1755

Description

@olivierr91

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

  1. Load the following SVG using Node and pass the content to parse()

Image

  1. Bizarre and invalid HTML tag gets created, and the SVG does not display:

Image

  1. Save the file with LF endings instead, and retry step 2. SVg gets parsed correctly.

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

  • Version: 5.2.2
  • Platform: NextJS/NodeJS
  • Browser: Edge
  • OS: Windows x64

Activity

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

Metadata

Metadata

Labels

questionFurther information is requested

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions