Skip to content

Invalid component name error for valid name that uses unicode characters #8564

@youngrok

Description

@youngrok

Version

2.5.16

Reproduction link

https://jsfiddle.net/50wL7mdz/536596/

Steps to reproduce

  1. register component with unicode component name. ex: my-컴포넌트
  2. use it in template. ex: <my-컴포넌트></my-컴포넌트>
  3. Vue warn is logged and component is not rendered.

What is expected?

No error, no warning. The component should be rendered properly.

What is actually happening?

The component is not rendered with this warning.

[Vue warn]: Invalid component name: "my-컴포넌트". Component names can only contain alphanumeric characters and the hyphen, and must start with a letter.


Component-Names in Vue Guide says,

we strongly recommend following the W3C rules for custom tag names (all-lowercase, must contain a hyphen)

However, W3C rules allow lots of unicode characters for component name. I think these two rules are important:

  • They start with a lowercase ASCII letter, ensuring that the HTML parser will treat them as tags instead of as text.
  • They do not contain any uppercase ASCII letters, so user agents can always treat HTML elements ASCII-case-insensitively.

The rules prevent using uppercase ASCII letters, and does not force using only lowercase ASCII letters. They allow unicode characters, but Vue.js doesn't accept unicode component names.

Furthermore, the error level is not error but warn, but it doesn't work in some cases like using it as custom element in template. It works when routed by vue router.

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