Re: [w3c/webcomponents] Why do we really need hyphens? (#658)

@trusktr Just in response to a couple things from [the other thread](https://github.com/w3c/webcomponents/issues/716#issuecomment-365166602) that are more relevant here.

> Just like with variable shadowing in practically any programming language

The thing is it's more like variable reassignment given that if the tag already has a value it somehow has to be assigned. This isn't unique to global tags in document, even if a tag is part of the shadow DOM if behavior of the tag changes *after* the element has been filled then there's a period of standard DOM behavior.

> then, who cares if the browser introduces a new <magic> element later

And this is the thing I'm getting at is depending on the behavior of this new HTML `<magic>` tag you might either not notice at all, or perhaps it's a metadata tag that just happens to have a name collision with your tag which changes some semantics drastically (e.g. something like `<base>` which changes whole other parts of the HTML algorithm).

Now detecting usage of this sort've thing is improving with browser efforts so it might be that WHATWG can just ask browser vendors to detect usage of a certain word if they want to add new tags so it might not be that risky in practice.

> Sometimes I do something dumb like <stu-pid> just to get around the limitation and keep the single <wo-rd> element, which is awkward.

Trailing dashes are valid in custom element names so you can avoid cutting words by using `<stupid->`/`<link->` instead for now which is still an improvement if hyphen-less never happens.

---

ASIDE

Most uses of custom elements I've seen don't bother to use custom attribute names and just use single words which risk clashing with future global attributes (e.g. `id`-like). So perhaps developers don't really think the risk is that high.

ASIDE ASIDE

Interesting vue even goes so far as to abuse technically invalid attribute names like `@click="myHandler"` to add special vue behavior (even though usage of such attributes is very limited). So this indicates even more that developers aren't too concerned about risks introduced by invalid HTML that could break in future by changes to the HTML spec (although common usage ultimately just makes it impossible for such extensions to be added to HTML more so than breaking consumers).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/658#issuecomment-365220022

Received on Tuesday, 13 February 2018 10:36:59 UTC