Ram_T
Ram_T

Reputation: 8484

Polymer custom element naming convention feature/bug

In polymer documentation they said

By specification, the custom element's name must contain a dash (-).

So I make a custom element with name custom-element. Generally, everyone do that. But suddenly I got a doubt that can we have a dash at the ends?

Then I tried with customelement- and -customelement.

I wondered that having dash(-) at right side end is working. But having dash(-) at left side end is not working.

Is this a feature or a bug?

Upvotes: 0

Views: 46

Answers (1)

Mr.7
Mr.7

Reputation: 2713

It's not a bug. It's working as expected.

According to the spec your element need to have a dash in its name (e.g <my-tabs>). That way you're forced to add a namespace which avoids conflicts with existing elements. A valid custom element name is a sequence of characters name that meets all of the following requirements

[a-z] (PCENChar)* '-' (PCENChar)*

where PCENChar:=

"-" | "." | [0-9] | "_" | [a-z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]

ref: https://www.w3.org/TR/custom-elements/#prod-potentialcustomelementname

Hope this helps :)

Upvotes: 1

Related Questions