Skip to content

Whitespace being trimmed when rendering children #28

@freshly-pressed-trousers

Description

We've been using this with some great success for a while now but have come across an issue where whitespace seems to be trimmed in places when run through it. I've managed to replicate it fairly minimally.

The issue manifests itself like this:
image

The component itself is just:

import { define } from 'preactement';
import PropTypes from 'prop-types';

export default function TestComponent({ children }) {
	return children;
}

TestComponent.propTypes = {
	children: PropTypes.node.isRequired,
}

TestComponent.tagName = 'test-component'
TestComponent.attributes = [];

define(TestComponent.tagName, () => TestComponent, { attributes: TestComponent.attributes });

Before the JS is run the page is provided to the browser as:

image

And once it kicks in it seems to have a cheeky nibble at some of the whitespace:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions