svelte icon indicating copy to clipboard operation
svelte copied to clipboard

fix: use snippet as parent element of snippets childrens in validator

Open paoloricciuti opened this issue 2 months ago • 1 comments

Svelte 5 rewrite

Fixes #11462 by setting snippet as the parent_element in the validator statement when a Snippet is encountered. This obviously could allow for something like this

<table>
    <tbody>
        <tr>
            {#snippet cell(v)}Value: {v}{/snippet}
            {@render cell(1)}
        </tr>
    </tbody>
</table>

that will produce invalid html but that is already true if you declare the snippet outside of table.

{#snippet cell(v)}Value: {v}{/snippet}
<table>
    <tbody>
        <tr>
            {@render cell(1)}
        </tr>
    </tbody>
</table>

Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (main).

If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is svelte-4 and not main.

Before submitting the PR, please make sure you do the following

  • [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • [x] Prefix your PR title with feat:, fix:, chore:, or docs:.
  • [x] This message body should clearly illustrate what problems it solves.
  • [x] Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • [x] Run the tests with pnpm test and lint the project with pnpm lint

paoloricciuti avatar May 04 '24 15:05 paoloricciuti

🦋 Changeset detected

Latest commit: 1aabba778a1a48c71a774e31fce82d71198962a8

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

This PR includes changesets to release 1 package
Name Type
svelte Patch

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

changeset-bot[bot] avatar May 04 '24 15:05 changeset-bot[bot]