[whatwg] hrefclass attribute ? -- semantics token reuse

On Sat, 26 Nov 2005, Charles Iliya Krempeaux wrote:
> 
> Now, although I still think "rel" and "rev" attributes on the <form> 
> element would be useful, I did note (to myself) that in some cases "rel" 
> and "rev" were not what I really wanted.  "rel" and "rev" specify 
> semantics between (all or part of) the document they are in and the 
> resource the "href" (or "action") attribute points to.  (At least that's 
> my understanding of it.) [...]
> 
> Now, sometimes you just want to specify semantics about the resource at 
> the end of the "href" (or "action") attribute without there necessarily 
> having to be a relation (between the 2 resources).
> 
> Here's an examples where we can specify semantics about the resource at 
> the end of the "href":
> 
>     <a hreflang="en-CA" href="http://example.com">...</a>
> 
> (The important part in that example is the "hreflang" attribute.) This 
> would tell you that the resource indicated by "http://example.com" has a 
> base language of "Canadian English". [...]
> 
> Also, we could show examples for the <form> element with respect to the 
> "action" attribute; the <blockquote> element with respect to the "cite" 
> attribute; the <img>, <script>, and <style> elements with respect to the 
> "src" attribute.  (This isn't an exhastive list.)
> 
> The problem here is that these attributes provide only limited metrics 
> which we can specify semantics on.  For semantics beyond any of these 
> metrics, we have the "class" attribute at our disposal.  (For this 
> discussion, I don't think it is relevant if the UA -- the web browser -- 
> necesarily understands that semantics exposes through the "class" 
> attribute.)
> 
> Among other things... like styling... the "class" attribute let's us 
> specify semantics. [...]
> 
> Now, although there is nothing I can see that would prevent use of the 
> "class" attribute from being used to specify semantics on the resource 
> at the end of the "href" for the <a> or <link> elements (or the resource 
> at the end of the "action" attribute on the <form> element, or the 
> resource at the end of the "cite" element for the <blockquote> element, 
> or the resource at the end of the "src" attribute for the <img>, 
> <script>, or <style> elements, etc) it does make it somewhat difficult 
> or impossible to reuse semantic tokens.  Let me illustrate this with an 
> example.
> 
> Let's say there there is a blog at http://example.com/.  And let's say 
> we have a blog post (for this blog) at http://example.com/log/1234.html.  
> Now let's say this blog post -- http://example.com/log/1234.html -- 
> contain the following link:
> 
>     <a rel="author" href="http://example.com/">...</a>
> 
> (Pay attention to the "rel" attribute in that example.)  This would 
> "say" that the author of that blog post -- 
> http://example.com/log/1234.html -- is http://example.com/.  Now let's 
> look at http://example.com/.  This could contain the following link:
> 
>     <a rev="author" href="http://example.com/log/1234.html">...</a>
> 
> (Pay attention to the "rev" attribute in that example.)  This would 
> "say" that http://example.com/ is the author of what's pointed to by the 
> "href" attribute -- http://example.com/log/1234.html.
> 
> The important thing here is that we reused the same (semantic) token -- 
> author -- in both cases.  (Once in the "rel" attribute and the other in 
> the "rev" attribute.)  IMO, doing this semantics token reuse is a boon 
> and increases developer usability.

Though not, it seems, developer use. While "rel" is widely used, "rev" is 
almost only ever used to say "rev=made", which is equivalent to 
"rel=author" in your example above.


> For purposes of (semantic) token reuse, it would be nice if there was 
> something like an "hrefclass" attribute.  For example, let's say we had:
> 
>     <ul class="shows">
>         <li>a</li>
>         <li>b</li>
>         <li>c</li>
>     </ul>
> 
> Now, lets say that instead of including this in our document, that we 
> wanted to defer this to somewhere else.  Then having something like the 
> following would be very useful.
> 
>     <a hrefclass="shows" href="http://example.com/shows">...</a>
> 
> Now, it's true that with the "class" attribute by itself we could do 
> something like:
> 
>     <a class="href-shows" href="http://example.com/contact"></a>
> 
> or:
> 
>     <a class="refersto-shows" href="http://example.com/contact"></a>
> 
> But we don't have semantics token reuse in these cases.

Why not just say class="shows", and define the class as being relative to 
the link target when used on a link?


> With semantics token reuse one could imagine something like "generic" 
> parsers and web crawlers finding information when the things are spread 
> out across multiple documents.  Since the same "semantic token" is used 
> in each case.  All they'd need to do is "connect" things with the same 
> name.  (Without having to know anything about the "meaning" of the 
> semantic tokens.)  (Not to mention that it makes for better developer 
> usability.)

One could imagine the like, but in practice they are quite rare, although 
there's not really anything that would stop them existing today...


On Sun, 27 Nov 2005, ROBO Design wrote:
> 
> My take on this: use rel and rev, no need for hrefclass. Almost each 
> time when an author wants to define the semantics of a resource, it's 
> *almost* always in relation to the current document (rel or rev, of 
> course). The way I see it, hrefclass would be useful only if it's 
> defined in a "neutral manner", as in: the resource identified by the 
> link can be taken entirely out of context and the semantics defined by 
> hrefclass can also be taken out of context too, without any relation to 
> the initial document.

I agree, rel and class are enough for this IMHO.


Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 31 October 2007 18:34:07 UTC