- From: Michael[tm] Smith <mike@w3.org>
- Date: Wed, 16 Oct 2013 17:16:25 +0900
- To: Steve Faulkner <faulkner.steve@gmail.com>
- Cc: Silvia Pfeiffer <silviapfeiffer1@gmail.com>, public-html <public-html@w3.org>, Sam Ruby <rubys@intertwingly.net>
Steve Faulkner <faulkner.steve@gmail.com>, 2013-10-16 08:11 +0100: > On 16 October 2013 07:28, Michael[tm] Smith <mike@w3.org> wrote: > > A library is by definition non-private. I don't see a gray area there. > > data-* isn't intended for use in libraries. I think there's nothing wrong > > with a library minting attribute names as long as there's good > > documentation about what the attributes are and how to use them. > > > > But my point is, that's not what data-* is for. If libraries are > > minting attributes that they intend for non-private use, they shouldn't > > be using data-* for that. And whatever might motivate them to use > > data-*, we should fix that so that they aren't inclined to do that. >> > hey mike, > > so is the use of data- in the G+ button public or private? > > <!-- Place this tag where you want the +1 button to render. --> > <div class="g-plusone" data-annotation="inline" data-width="300"></div> > > https://developers.google.com/+/web/+1button/ Well, after going back and actually reading the spec, I see I pretty much was wrong about what the spec says. The spec says this: "JavaScript libraries may use the custom data attributes, as they are considered to be part of the page on which they are used. Authors of libraries that are reused by many authors are encouraged to include their name in the attribute names, to reduce the risk of clashes. "For example, a library called "DoQuery" could use attribute names like data-doquery-range, and a library called "jJo" could use attributes names like data- -range. The jJo library could also provide an API to set which prefix to use (e.g. J.setDataPrefix('j2'), making the attributes have names like data-j2-range)." So, what Silvia was describing and what you're describing above are not abuses of data-* as far the spec is concerned. But the problem I have with encouraging those kind of uses is that we can't provide authors with any validation of the microsyntax/datatypes of the values of custom data-* attributes. For example, in the case of the Google Plus button markup, I see from reading their documentation[*] that there are a discrete set of values ("none", "bubble", and "inline") that the data-annotation attribute is expected to have, and a specific datatype (integer) that the data-width attribute is expected to be. [*] https://developers.google.com/+/web/+1button/#plusone-tag-attributes So with the current semantics that the spec gives for data-* attributes we couldn't really ever provide a way to check and warn an author about an error like data-annotation="bubbel" or width="20%" -- any more than we could/should provide a way, say, to check values of the class attribute. What I mean is, per the HTML spec, there are no invalid values for data-* attributes, any more than there are invalid values for the class attribute. I'd argue that in order to do the right thing for authors, we should keep it that way, and not have libraries and services like Google Plus relying on content to use data-* values with particular datatypes. --Mike -- Michael[tm] Smith http://people.w3.org/mike
Received on Wednesday, 16 October 2013 08:16:44 UTC