Skip to content

Ignore whitespace in the container element when reusing markup #996

@Rowno

Description

@Rowno

At the moment, if there's any whitespace around a pre-rendered component inside it's container, the HTML won't be reused. This is because getReactRootElementInContainer() uses Node.firstChild which will return a TEXT_NODE instead of an ELEMENT_NODE in this case.

For example, this HTML won't be reused:

<div class="wrapper">
    <div class="component" data-reactid=".r[1wtmm]" data-react-checksum="490228448">...</div>
</div>

If you want, I can send through a pull request that changes getReactRootElementInContainer() to look for the first ELEMENT_NODE instead of just any Node.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions