[whatwg] microformats, microdata, and custom data attributes

Justin Karneges justin at affinix.com
Fri Apr 15 18:29:06 PDT 2011


Hi folks,

I'm desiring a way to markup "mentions of a person" semantically within HTML, 
for use in an open standard.  Think of a more rich form of the @person 
convention used on Twitter and elsewhere:

<p>@justin I totally agree</p>

My first thought was to use a data-* attribute.  For example:

<p><a href="http://example.org/justin/" data-mention-
id="acct:justin at example.org" data-mention-context="reply">justin</a> I totally 
agree.</p>

However, the HTML specification says custom data attributes are only to be used 
privately.  So, I am not sure if it is appropriate to create a public standard 
whereby independent developers are encouraged to utilize a common data-* 
attribute.

Another way is to use Microdata, though I seem to have to hack it a bit to 
have hidden values:

<p><a href="http://example.org/justin/" itemscope 
itemtype="http://example.org/itemtypes/mention" 
itemid="acct:justin at example.org"><span itemprop="context:reply"/><span 
itemprop="name">justin</span></a> I totally agree.</p>

There may be a similar approach using the Microformats conventions (read: 
classes), but I don't know if that is frowned upon.

I apologize if this is the wrong list to post to.  I figured since it is a 
standards-ish question that this list would be the best place to find nitpicky 
gurus on that topic (particularly the bit about public usage of data-* 
attribute).

Thanks,
Justin


More information about the whatwg mailing list