W3C home > Mailing lists > Public > public-html@w3.org > October 2009

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

From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Mon, 19 Oct 2009 20:27:29 +0200
Message-ID: <4ADCAF91.9050109@xn--mlform-iua.no>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: Shelley Powers <shelley.just@gmail.com>, James Graham <jgraham@opera.com>, Anne van Kesteren <annevk@opera.com>, Adrian Bateman <adrianba@microsoft.com>, Jonas Sicking <jonas@sicking.cc>, Tony Ross <tross@microsoft.com>, "public-html@w3.org" <public-html@w3.org>
Tab Atkins Jr. On 09-10-19 19.11:

> 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.

 From the SVGweb quick-start:

]]If your HTML page and the SVG Web library are in different 
directories, you also must provide a data-path HTML 5 attribute 
pointing to where the SVG Web files are.[[

> 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.


@data-path seemed pretty generic. And in my mind (or in a code 
example I Googled) they used it on <object>, which already has @data.

It seems to me to be on the edge of what @data-*'s specified 
purpose to distribute a software package that requires that you 
use a specific and - to use Aryeh' wording - "non-standard" 
attribute. It ought in my view to be good practice offer a simple 
way to change the name of the data-* attribute when it is included 
in distributions. It also seems like a good practice to recommend 
the use of an extra prefix, such as you suggested: data-svgweb-*.

One thing is what you can google, but you as single author may 
also need to use data attributes for your own purposes.

 
> 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?

I don't think it is name crashes that is the most important 
feature of  using namespaced attribute. Far more important  would 
it be that you, as author, could grasp where this extension takes 
its semantics from.

E.g., again, I read data-path="" as meant very generic, and 
thought it was a IE workaround ...
-- 
leif halvard silli
Received on Monday, 19 October 2009 18:28:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:50 GMT