Re: data-* attributes [was: Re: ISSUE-41/ACTION-97 decentralized-extensibility]

On Mon, Oct 19, 2009 at 11:31 AM, Shelley Powers <shelley.just@gmail.com> wrote:
> It is, but data-* does a poor job.
>
> SVGWeb can use a name, another JS library use the same name, and if a
> person wants to use both JS libraries together, they're screwed.
>
> The fact that data-* had no ability to enforce a consistent name clash
> prevention shows they're really not useful for decentralized
> extensibility.

I can't tell from searching around on the svgweb demos how it uses
data-* attributes, but this really shouldn't be a problem in practice.

If svgweb uses data-svgweb-* attributes, frex, then the chance of
clashing with another library is basically nil.  Before starting any
new library one should probably google for a bit to make sure that
one's preferred name for the project isn't already being used.

Before you can say that data-* is "really not useful for decentralized
extensibility", you'd have to show how, even with this basic friendly
practice of "self-namespacing", there were clashes in data-* attribute
naming in practice with half-significant libraries.  Preferably, you'd
show how this actually caused some authors some grief, such as through
bug reports or forum posts complaining.

I'll note that a similar practice is used in jQuery's plugin
architecture, and it generally works fine.  Even though everyone wants
their plugin to have a short name, there are just *so many* names to
choose from that it's pretty easy to find a good unique one.

I suspect that this style of self-policed namespacing is used widely
in this sort of space.  Have there been any notable failures?

~TJ

Received on Monday, 19 October 2009 17:12:07 UTC