W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2015

Re: Are web components *seriously* not namespaced?

From: Melvin Carvalho <melvincarvalho@gmail.com>
Date: Thu, 5 Feb 2015 15:51:45 +0100
Message-ID: <CAKaEYh+T1P84mRnuH62nYnfHK_Yah5qjt39SDWYPJ9RmY-HWHA@mail.gmail.com>
To: Glen <glen.84@gmail.com>
Cc: WebApps WG <public-webapps@w3.org>
On 4 February 2015 at 22:31, Glen <glen.84@gmail.com> wrote:

> I know I'm rather late to the party, but I've been doing a lot of reading
> lately about web components and related technologies, and the one thing
> that confounds me is the fact that web components appear not to have any
> "real" namespacing.
>
> Can someone explain why this is so, and what the justification is? Or is
> it just a case of "it was too complicated, this is good enough"?
>
> I see this has been brought up once before @ http://lists.w3.org/Archives/
> Public/public-webapps/2013AprJun/0964.html, but nothing changed.
>
> It's not going to be long before <x-tabs> has been defined by 1,000,000
> people (slight exaggeration), and you have no idea what it is or where it
> came from without looking through imports/scripts etc. Also you want to
> keep things short, so you call your element <ms-panel> (you work for Monkey
> Solutions LLC), but then someone else on the team is importing <ms-panel>
> from Microsoft, and BAM!, you have another problem.
>
> Why can't we do something like this?
>
> <!-- /scripts/monkey-solutions/panel.js -->
> <script>
>     var panel = document.registerElement("panel", {
>         namespace: "ms https://monkey-solutions.com/namespace"
>     });
> </script>
>
> <!-- /scripts/microsoft/panel.js -->
> <script>
>     var panel = document.registerElement("panel", {
>         namespace: "ms https://microsoft.com/namespace"
>     });
> </script>
>
> <!-- Uses last defined element, as it currently works. -->
> <ms-panel>
>
> <!-- Redefine the namespace prefix for one of the custom elements. -->
> <element name="panel" namespace="https://microsoft.com/namespace"
> prefix="msft" />
>
> <ms-panel>
> <msft-panel>
>
> You could also assign a prefix to all elements within a namespace like
> this:
>
> <element name="*" namespace="https://microsoft.com/namespace"
> prefix="msft" />
>
> You can override the prefix multiple times and the closest <element>
> definition is used.
>
> Please note that the above syntax is just an example of what could be used.
>
> Another BIG pro here is that IDEs can pull in information about the
> elements by sending an HTTP request to the namespace URI so that a tooltip
> could be displayed with an element description, author, sample usage, etc.
>
> I really do hope that it's not too late to make such a change.
>

+1 to everything

Could a colon perhaps be saved as a special character so in future you can
have <ms:panel> and <msft:panel> and the user agent would be able to work
out which code to use?


>
> Regards,
>
> Glen.
>
>
Received on Thursday, 5 February 2015 14:52:19 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:25 UTC