Skip to content

Conversation

@Teiem
Copy link

@Teiem Teiem commented Nov 18, 2025

Relevant RFC, specifically this comment which has the most upvotes.

In short, this PR would allow comments in the form of {/* some comment*/} where an html attribute is expected, e.g.

<Tag {/* comment */}></Tag>

This would be useful to quickly comment out single attributes of an HTML element.
What does not work is using this to comment out the entire tag, for that we already have normal html comments (<!-- -->).

Implementation wise this is an empty attribute which will then be ignored by the parser.

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.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

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

@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2025

🦋 Changeset detected

Latest commit: 85242fc

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

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

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

@svelte-docs-bot
Copy link

@github-actions
Copy link
Contributor

Playground

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

@techniq
Copy link

techniq commented Nov 19, 2025

One workaround I use is to add an underscore (_) prefix to the prop/attribute

<Button _color="blue">

This works except for svelte-check getting cranky.

also if I'm trying a few options I will add additional underscores:

<Button _color="blue" __color="red" color="green">

Having a way to comment out attributes similar to React would be great though!

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.

2 participants