[whatwg] hrefclass attribute ? -- semantics token reuse

Hello,

This is kind of a follow up to a previous post of mine:

rel/rev for <form> ?
http://listserver.dreamhost.com/pipermail/whatwg-whatwg.org/2005-November/005039.html
http://listserver.dreamhost.com/pipermail/whatwg-whatwg.org/2005-November/thread.html#5039

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.)  For example:

    <a rel="alternate" type="application/rss+xml"
href="http://example.com/feed" />

    <a rel="friend met" href="http://joe-blow.example.com/">...</a>

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". 
Here's another example:

    <a type="application/x-bittorrent"
href="http://example.com/test.torrent">...</a>

(The important part in that example is the "type" attribute.)  This
would tell you that the resource indicated by
"http://example.com/test.torrent" has a content type of
"application/x-bittorrent"

We could also show similar examples for the <link> element.  Like:

    <link rel="stylesheet" type="text/css" media="tv" href="/style/tv.css" />

(Here we have the familiar "rel" specifying semantics, in addition to
"type" and "media", about the resource indicated by the "href"
attribute.)

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.  For example:

    <div class="vcard">
        <a class="fn" href="mailto:charles at reptile.ca">Charles Iliya
Krempeaux</a>
        <span class="tel">
            <span><span class="value">+1.604.737.8453</span>
            <abbr class="type" title="work">(work)</abbr>
        </span>
    </div>

(For those curious, this is an hCard -- http://microformats.org/wiki/hcard )

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.

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.

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.)

Is there anything like this in the works?


See ya

--
    Charles Iliya Krempeaux, B.Sc.

    charles @ reptile.ca
    supercanadian @ gmail.com

    developer weblog: http://ChangeLog.ca/
___________________________________________________________________________
 Never forget where you came from

Received on Saturday, 26 November 2005 14:28:49 UTC