This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Custom element names must contain a hyphen, so e.g. `foo` is invalid, but `foo-bar` is valid. However, as per the current rules, e.g. `foo-` is valid too. IMHO it would make sense to tighten the requirement by disallowing trailing hyphens, thus making `foo-` invalid.
Similarly, how about disallowing consecutive hyphens? `foo----bar` is not really a nice element name.
Nah, it'd be nice if this test case was valid: <foo-- id="x"/> <script> x.innerHTML = "</foo--><!--"; // wut </script> (j/k) But it's not clear to me what the point is. We don't disallow data----="" either.
I seem to remember Dimitri mentioning there's some library that's intentionally using custom element names with trailing hyphens.
I completely agree with Mathias, trailing hyphen or consecutive could cause a lot of confusion in naming, would be great to have these rules landed.
(In reply to Mathias Bynens from comment #0) > Custom element names must contain a hyphen, so e.g. `foo` is invalid, but > `foo-bar` is valid. > > However, as per the current rules, e.g. `foo-` is valid too. IMHO it would > make sense to tighten the requirement by disallowing trailing hyphens, thus > making `foo-` invalid. Can you help me understand what the problem is? If it's just aesthetics, I would really like to avoid dictating such opinions in a spec. For example, I quite like http://charbelrami.github.io/math-elements/ and don't see anything wrong with it.
Assuming no changes are necessary to the spec. Please reopen if you feel otherwise.