Skip to content
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

Improve error message for hyphenless component names #3867

Closed
dtruffaut opened this issue Aug 15, 2016 · 2 comments
Closed

Improve error message for hyphenless component names #3867

dtruffaut opened this issue Aug 15, 2016 · 2 comments
Labels

Comments

@dtruffaut
Copy link

Description

When I create a polymer element without hyphen in its name, an error is raised, but the message is quite obscure... Let's say it does not help the developer.

Please consider updating the message with a more meaningful content.

Steps to Reproduce

  1. Create new element test
  2. Use the element test
  3. Refresh the page

Expected Results

polymer-micro.html:65 Uncaught SyntaxError: Failed to execute 'registerElement' on 'Document': Registration failed for element 'test'. Element name must contain an hyphen: '-'. Example: 'my-test'. See https://www.w3.org/TR/custom-elements/#valid-custom-element-name for reference.

Actual Results

polymer-micro.html:65 Uncaught SyntaxError: Failed to execute 'registerElement' on 'Document': Registration failed for type 'test'. The type name is invalid.

Browsers Affected

Tested on Chrome

Versions

  • Polymer: v1.6.1
  • webcomponents: v0.7.22

See also:

divshot/ele-web#22
#1163

@ebidel
Copy link
Contributor

ebidel commented Sep 9, 2016

I've had a PR open for 10 months that fixes this and adds some other helpful debugging stuff.

I don't thin the core team is going to add this. But the good news is custom elements v1 has an improved error message when you try to register an element name without a "-". Polymer 2 will be using that updated API.

@TimvdLippe
Copy link
Contributor

As Polymer 2 uses the v1 API, this error message is controlled by the spec. If you execute it today, you receive: Failed to execute 'define' on 'CustomElementRegistry': "foo" is not a valid custom element name. If you would like to see a change in this error message, please open an issue on https://github.com/w3c/webcomponents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants