This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25283 - [Custom]: Custom element names should not end with a hyphen
Summary: [Custom]: Custom element names should not end with a hyphen
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14968
  Show dependency treegraph
 
Reported: 2014-04-07 11:07 UTC by Mathias Bynens
Modified: 2014-05-05 17:58 UTC (History)
5 users (show)

See Also:


Attachments

Description Mathias Bynens 2014-04-07 11:07:21 UTC
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.
Comment 1 Mathias Bynens 2014-04-07 11:08:51 UTC
Similarly, how about disallowing consecutive hyphens? `foo----bar` is not really a nice element name.
Comment 2 Simon Pieters 2014-04-07 12:02:03 UTC
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.
Comment 3 Michael[tm] Smith 2014-04-07 12:04:31 UTC
I seem to remember Dimitri mentioning there's some library that's intentionally using custom element names with trailing hyphens.
Comment 4 Mykyta Semenistyi 2014-04-07 14:08:46 UTC
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.
Comment 5 Dimitri Glazkov 2014-04-07 15:32:44 UTC
(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.
Comment 6 Dimitri Glazkov 2014-05-05 17:58:19 UTC
Assuming no changes are necessary to the spec. Please reopen if you feel otherwise.