Skip to content

Error on invalid tag names #12925

Closed
@Rich-Harris

Description

@Rich-Harris

Describe the problem

As of #12821, we error on invalid component names. We don't have any similar validation for element names.

In Svelte 4, something like <yes[no]> is a runtime error, because you can't do this:

document.createElement('yes[no]');

Because we use template cloning in Svelte 5, we don't hit that constraint — it just lets you create an obviously-incorrect element. We should have some validation here

Describe the proposed solution

Either replace the 'invalid component name' error with a more generic 'invalid tag name' error, or have some way of determining whether a tag name is supposed to be a component or an element before we've been able to determine whether it's valid

Importance

nice to have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions