Skip to content

Allow for comments inside element tags #17155

@petdomaa100

Description

@petdomaa100

Describe the problem

When I have many attributes on an element, I often comment them in-and-out while developing to see how event calbacks, styles, etc, behave in isolation. This works as expected in other frameworks.

However, Svelte doesn't seem to allow comments within element tags. The following snippet errors with '<!--' is not a valid attribute name:

<div
  <!-- id="" -->
  class=""
>
  ...
</div>

This wouldn't be valid HTML syntax, but this restriction just makes my life a harder.

Describe the proposed solution

Make these types of comments valid Svelte syntax and strip them out from the compiled output.

Importance

would make my life easier

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions