Re: using the data* attribute to identify element sub roles

On Monday, 18. February 2013 at 09:12, Steve Faulkner wrote:
> the use cases I had in mind is that currently the definitions of some elements have differing uses:
> 
> article can idenity a 1000 word essay, a 100 word summary of said essay and a 5 word comment on the same essay, but there is no method defined to idenitfy the different uses. If there was a defined method, a range of software could make use of it such as search engines and assistive technology.
This is true. But you can separate them with the <header>, <div>, <footer> elements already I think.

A different thing are for example interviews. There is no really good approach to semantically mark up Q&A in HTML. This is where it could make sense to set data-attributes. But here it won't be enough to specify the data-[element] as you need to specify wether it is a question or answer, right?

<p class="question" data-question>Question 1?</p>
<p class="answer" data-answer>Answer 1</p>

This would improve the spec's way of formatting interviews [1].

Therefore I don't think it is a good idea to set a default behavior / semantic value for some data-attribute names as they're only covering a very limited part of use-cases and are not easy to handle for developers.
As Silvia stated now during me writing that mail, it would be confusing that *some* data-attributes have semantic value whereas most don't. 

-----
[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/common-idioms.html#conversations

Regards,
Anselm
> regards
> Stevef
> 
> On 18 February 2013 07:59, Anselm Hannemann <info@anselm-hannemann.com (mailto:info@anselm-hannemann.com)> wrote:
> > > From: Steve Faulkner <faulkner.steve@gmail.com (mailto:faulkner.steve@gmail.com)>  
> > > Date: Mon, 18 Feb 2013 07:26:52 +0000
> > > Message-ID: <CA+ri+Vn+zcfZT5BP2w3x4WNwu2o2h9GvyPff0znDPVzqaxJYvg@mail.gmail.com (mailto:CA%2Bri%2BVn%2BzcfZT5BP2w3x4WNwu2o2h9GvyPff0znDPVzqaxJYvg@mail.gmail.com)> 
> > > To: HTMLWG WG <public-html@w3.org (mailto:public-html@w3.org)> 
> > > NOTE: this is just a wild idea.
> > > 
> > > allow the data attribute [1] to be used to identify element sub roles:
> > > 
> > > examples:
> > > 
> > > <h1>heading</h1> <p data-p="subheading">subheading</p> 
> > > 
> > > <article data-article="comment"> blog post comment </article>
> > > 
> > > allow data-elementname="subRole" pairs to be added to a public registry.
> > > 
> > > thoughts? 
> > I don't understand the logic of the data-attribute yet. Shouldn't there be a reference to which the attribute refers?
> > In that case to the h1-element. That means, for me it would be logical to have:
> > > <h1>heading</h1> <p data-h1="subheading">subheading</p>
> > 
> > 
> > But then the semantics is away for the element attribute itself.
> > I think I have a lack on use-cases here to can think of if this could work and is useful.
> > 
> > / Anselm  
> > -----------
> > Anselm Hannemann
> > @helloanselm
> > > [1] http://www.w3.org/html/wg/drafts/html/master/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes
> > > 
> > > -- with regards
> > > 
> > > Steve Faulkner 
> > 
> > 
> > 
> > 
> 
> 
> 
> 
 (http://www.paciellogroup.com/resources/wat-ie-about.html) 

Received on Monday, 18 February 2013 08:28:40 UTC