-
Notifications
You must be signed in to change notification settings - Fork 9
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
Dashless element name error duplicates the preview iframe #22
Comments
+1 I just got The rule that names must contain a dash is unusual, why does polymer impose that constraint? |
@eighttrackmind It's not Polymer, it's the Web Components spec. The idea is that by requiring a dash in the name (which no native elements have) there's no chance of accidentally registering over an existing tag. An interesting and pragmatic solution, but can bite you if you're unaware. |
That's really interesting, thanks for the quick response. It's clever but seems like an odd constraint - to avoid overloading native elements a custom element must have a dash in its name, but to avoid overwriting native attributes custom attributes should start with It also doesn't solve the problem of name collisions. Since web components are imported into a global namespace, there will almost certainly be collisions for large applications with lots of 3rd party components (if I understand how web components work correctly). The dash-case requirement is seems like a pretty gnarly workaround that makes this issue a bit less likely to occur. I feel like a more normalized and scalable solution would be to overload XML namespaces, so my custom tag could be Alternatively, components could be explicitly scoped like imports in most languages, eg. |
There are definitely some interesting edge issues around imports, namespace collisions, etc. Once you get used to the dashes, though, it feels pretty natural. I was a bit surprised that they didn't go for XML namespaces, but there's probably a good reason for it. |
We should catch the error:
And tell beginners they need a dash in their element name. Also, don't duplicate the iframe on an error.
The text was updated successfully, but these errors were encountered: