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

fix: relax parent validation #14442

Merged
merged 1 commit into from
Nov 26, 2024
Merged

fix: relax parent validation #14442

merged 1 commit into from
Nov 26, 2024

Conversation

dummdidumm
Copy link
Member

@dummdidumm dummdidumm commented Nov 26, 2024

This reverts #13255 / #13158, and helps with the validation error part of #14120

If you would have a component like this...

<td>hi there</td>

...and then render it on the server via our render function like this:

const result = render(Main);

...then right now you get an error saying that td is not valid at this position. But that doesn't seem right, because we should give people the benefit of the doubt: It may very well be that someone renders such a component and then correctly puts it into a tr tag themselves on the server (another example is rendering a full html document like in #14120).

All the other validation where there's a known parent (X not valid inside Y) is untouched by this.

Doing this as cleanup prior to tackling #13331

This reverts #13255 / #13158, and helps with the validation error part of #14120

The revert is justified because people should be free to render a component in isolation and then append it somewhere where they know the rendered output is valid. If someone renders a tag at the top level that is invalid without a certain parent (which itself is an edge case), then the likelihood that this is done on purpose is much higher than that it's done by accident.
Copy link

changeset-bot bot commented Nov 26, 2024

🦋 Changeset detected

Latest commit: c1d2881

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Rich-Harris
Copy link
Member

preview: https://svelte-dev-git-preview-svelte-14442-svelte.vercel.app/

this is an automated message

Copy link
Contributor

Playground

pnpm add https://pkg.pr.new/svelte@14442

@dummdidumm dummdidumm merged commit 9e9fb24 into main Nov 26, 2024
11 checks passed
@dummdidumm dummdidumm deleted the relax-html-validation branch November 26, 2024 15:00
@github-actions github-actions bot mentioned this pull request Nov 26, 2024
@trueadm
Copy link
Contributor

trueadm commented Nov 28, 2024

It looks like this PR caused a regression: #14466

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

Successfully merging this pull request may close these issues.

3 participants