[whatwg] the cite element

Hugh Guiney hugh.guiney at gmail.com
Wed Oct 7 15:40:32 PDT 2009


On Tue, Oct 6, 2009 at 6:33 PM, David Workman <workmad3 at gmail.com> wrote:
> I don't know about others, but that just looks ugly to me (the repetition of
> 'cite' looks unnecessary). I know elegance isn't crucial, but given the
> choice between <cite for=""> and <cite cite=""> I'd go for the former.
>
> As a possibility though, <cite> could have a 'for' attribute in the same
> manner as a label and also support a 'src' attribute to link the element to
> the original source, giving:
> <cite for="aside-id" src="uri">
> What browsers do with the src attribute can be decided later, but it could
> easily be used as a more semantically meaningful <a> tag where appropriate.
Well, I don't exactly mind the repetition of "cite", though @for is
probably better as it's an existing attribute and already serves the
same purpose.

@src, however, should really only be used for replaced content. It
does not mean "source" in the sense of attribution, but in the sense
of derivation. I like the idea but I'd go for @href instead, e.g.:

<p>As <cite for="gettysburg"
href="http://www.whitehouse.gov/about/presidents/abrahamlincoln/">Abraham
Lincoln</cite> said, <q id="gettsyburg">Four score and seven years ago
...</q></p>

<p><cite href="http://www.imdb.com/title/tt0800080/">The Incredible
Hulk</cite> (2008) is a reboot of <cite
href="http://www.imdb.com/title/tt0286716/">Hulk</cite> (2003).</p>

@href creates an explicit link to the work or author being cited
(whereas <a> creates an arbitrary one). Whether this is displayed as a
traditional hyperlink or merely as a "more info" context menu, etc.
should be up to the UA. If it is rendered as a link though,
surrounding links should probably take precedence, i.e.:

<a href="http://en.wikipedia.org/wiki/Abraham_Lincoln"><cite
href="http://www.whitehouse.gov/about/presidents/abrahamlincoln/">Abraham
Lincoln</cite></a>

...would point to Wikipedia, and not the White House.

I'm not exactly sure that @for belongs on <cite> though, as the
relationship of author-to-quote is more often one-to-many than
one-to-one. It would be cumbersome and redundant for document authors
to have to specify the name every time in full just to create an
explicit association between the two. For instance, in a list of
famous quotes by Abraham Lincoln:

<ul>
<li>
<q id="gettsyburg">Four score and seven years ago ...</q> --<cite
for="gettysburg"
href="http://www.whitehouse.gov/about/presidents/abrahamlincoln/">Abraham
Lincoln</cite>
</li>
<li>
<q id="fool">Better to remain silent and be thought a fool than to
speak out and remove all doubt.</q> --<cite for="fool">Abraham
Lincoln</cite>
</li>
</ul>

is not as efficient as:

<h1>List of Quotes by <cite id="abe-lincoln">Abraham Lincoln</cite></h1>
<ul>
<li>
<q id="gettsyburg" for="abe-lincoln">Four score and seven years ago ...</q>
</li>
<li>
<q id="fool" for="abe-lincoln">Better to remain silent and be thought
a fool than to speak out and remove all doubt.</q>
</li>
</ul>

Dialogs would also benefit from this, as in:

<cite id="pete">Pete</cite>: <q for="pete">I'm joining a gang.</q>
<cite id="meredith">Meredith</cite>: <q for="meredith">You can't!</q>
<cite>Pete</cite>: <q for="pete">Don't try to stop me.</q>

Of course the downside to that is being unable to create a
relationship between all of a speaker's quotes and attributions
without inventing superfluous @ids. For that I propose an "alias"
attribute for <cite> which allows it to represent another instance of
that same attribution:

<cite id="pete">Pete</cite>: <q for="pete">I'm joining a gang.</q>
<cite id="meredith">Meredith</cite>: <q for="meredith">You can't!</q>
<cite alias="pete">Pete</cite>: <q for="pete">You can't stop me.</q>

which would also be useful in the informal abbreviation of titles of works:

<h1><cite id="borat"
href="http://www.imdb.com/title/tt0443453/">Borat: Cultural Learnings
of America for Make Benefit Glorious Nation of Kazakhstan</cite>
(2006)</h1>
<h2>My Review</h2>
<p><cite alias="borat">Borat</cite> is a hilarious film about...</p>


More information about the whatwg mailing list