Skip to content

fix: allow nested <dt>/<dd> elements if they are within a <dl> element #12681

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

Merged
merged 2 commits into from
Aug 1, 2024

Conversation

dummdidumm
Copy link
Member

This introduces a resets array, which means descendants that are forbidden are allowed again, if an element within the resets array is encountered between the tag and the forbidden descendant

fixes #12676

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

  • 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
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

…element

This introduces a resets array, which means descendants that are forbidden are allowed again, if an element within the resets array is encountered between the tag and the forbidden descendant

fixes #12676
Copy link

changeset-bot bot commented Jul 31, 2024

🦋 Changeset detected

Latest commit: 30841a4

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

@Conduitry
Copy link
Member

Maybe call this reset_by? resets sounds to me like it might be the dd/dt that's doing the resetting of dl, rather than the other way around.

@gu-stav
Copy link

gu-stav commented Jul 31, 2024

I'm not sure if I understand the test to it's full extend, but since quite some time divs are allowed as children of dl: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dl#wrapping_name-value_groups_in_div_elements

If I misread the test I apologize for the noise 😊

@dummdidumm
Copy link
Member Author

The div could also be a span, it doesn't matter, the rule is "there has to be a dl in-between, and it's not in that case so we issue the error. You can test yourself by pasting that html into the browser and see how it "repairs" it

@Rich-Harris Rich-Harris merged commit 9eca3d0 into main Aug 1, 2024
9 checks passed
@Rich-Harris Rich-Harris deleted the dt-dl-dd branch August 1, 2024 01:37
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.

<dt> is invalid inside <dd>
4 participants