In my opinion, fundamental problems like these really ought to be addressed before things become part of the web platform.
In my opinion, fundamental problems like these really ought to be addressed before things become part of the web platform.
Web Components trace their history to trying to explain how the web platform itself works. HTML is also a flat namespace, and the goal was to empower developers to do all the same things the platform does and in the same way.
We hotly debated namespaces when designing the API and in the end decided to omit them but require at least one dash. You can think of the prefix kind of like the namespace in that sense. And in practice with reasonable prefixing practices we find folks rarely (if ever) collide, the same as ObjC.
(Not that things couldn't be better: https://github.com/WICG/webcomponents/blob/gh-pages/proposal...)
Ah. I feel like the demos and examples that I've seen never have the first word as the pseudo-namespace so I had no idea that was the intention.
But then, all languages since Objective-C seem to agree that namespacing is a good idea. There's no debate there. Even JavaScript has modules now. So I can't help but wonder what makes web components unique in this regard.
(Yeah I work with XML day to day, yeah I might have some amount of Stockholm Syndrome associated with that.)
Fundamental enough to be included in the list of things to still fix for web components: https://w3c.github.io/webcomponents-cg/2022.html#scoped-elem...
Simple as that.