Re: Notification: Role Attribute Editor's Draft available

> Very specifically, I would change Appendix A in the Role documentation to
> something that describes how RDF triples can be created from a document
> with a @role attribute, without any reference to RDFa processing. And I do
> not think there should be any reference to @role in the HTML+RDFa
> document.
>
> (I have no problem with Role referring to the URI/CURIE mechanism of RDFa,
> of course, but that is a different matter.)

+1.

I've implemented support for @role in my parser, but don't really consider
it part of RDFa. (It's just too trivial a thing to justify writing a whole
separate parser for, so might as well bundle it in with RDFa.)

> It might also be worth considering defining a 'role' object in an API,
> that could refer to the core RDFa API elements like triplets or blank
> nodes. But, again, that should be disjoint from the strictly rdfa part of
> the API.
>
> Sorry if I sound a bit harsh...:-)

Role would probably benefit from a different, non-RDF API. Something like:

   var elements = document.getElementsByRole('contentinfo');
   for (var i=0; elements[i]; i++)
   {
     var roles = element[i].getRoles;
     for (var j=0; roles[j]; j++)
     {
       if (roles[j] != 'contentinfo')
       {
         window.alert("This contentinfo element also has role "+roles[j]);
       }
     }
   }

Node.getElementsByRole would take a single string parameter interpreted as
a URI. If the string matched NCName, it would be prepended with
"http://www.w3.org/1999/xhtml/vocab#". It would return all child nodes
that had that role.

Element.getRoles would return an array of role URIs that an element had.
If a role URI began "http://www.w3.org/1999/xhtml/vocab#" and the rest of
the role URI matched NCName, then this URI would be abbreviated by
removing that prefix.

Element.addRole and Element.removeRole might be handy too.

Something like that seems like it would be a lot more natural for those
who are used to traversing/manipulating the DOM tree via tag names,
classes, IDs, attributes, etc. @role becomes another facet of the DOM tree
they can use to find what they want on the page.

-Toby

Received on Friday, 23 April 2010 09:36:17 UTC