[whatwg] namespaces in html5

Tab Atkins Jr. jackalmage at gmail.com
Mon Jul 18 10:53:32 PDT 2011


On Mon, Jul 18, 2011 at 7:33 AM, David Karger <karger at mit.edu> wrote:
> Yes, we could,  but it doesn't address the two objections I raised to data-
> prefix:
> 1.  it isn't actually a data attribute, so prefixing with data seems odd
> (appearance; minor)

You seem to have mentally associated the data-* attributes with
Microdata.  There is no connection between them.  In fact, it's
impossible for Microdata to use the data-* attributes at all.

data-* attributes are for private script data that is, for whatever
reason, more convenient to attach directly to a DOM node than to hold
in a JS structure.  Wanting the data's link to DOM nodes to survive
serialization is a good reason.


> 2.  there's no way to guarantee someone else won't use the same data-exhibit
> prefix, causing incompatibilities (functionality; major)

In practice, the risk of prefix collisions has turned out to be
minimal in many real-world collections, such as jQuery plugins.  We
expect the same to apply here.  For maximum robustness, simply write
your library with the ability to accept a different prefix, so that if
a collision does occur the author can work around it.

~TJ



More information about the whatwg mailing list