[whatwg] href attribute

Alexey Feldgendler alexey at feldgendler.ru
Sun Mar 4 14:40:43 PST 2007

On Fri, 02 Mar 2007 18:25:45 +0100, Colin Lieberman <colin at fontshop.com>  

> Alexey, I see your point regarding buttons, but there are many other  
> cases where an a element seems unnecessary and redundant (as others have  
> pointed out):
> Navigation:
> <ul id="main_nav">
> <li href="/">Home</li>
> <li href="/about/">About</li>
> </ul>

How is this better than <li><a></a></li>, not taking the amount of typing  
into account?

> clickable images (like a thumbnails gallery)

This is not really different from "clickable text".

Clickability is a presentational/behavioral property specific to  
interactive visual media with a pointing device, but the semantics of  
clickable-something is usually "hyperlink" (though sometimes e.g.  
"button"). To express hyperlink semantics, we have <a>.

> glossary links: <abbr title="hypertext markup language"  
> href="/glossary.php#html">html</abbr>

For <abbr>, it's probably worth adding the href attribute if the use case  
is frequent. The rationale would be that the semantic unit delimited by  
<abbr> can be said to have such property as the reference URL to look up  
the definition.

> There are, I think, numerous cases like these we encounter every day  
> where an a is slipped inside another element because that's the only way  
> to make the link, and the anchor itself serves no other purpose.

Most cases when there are nested <a> and some other element which cover  
exactly the same range (<a><other>...</other></a> or  
<other><a>...</a></other>) don't deserve merging of <a> and <other>  
because it just happens sometimes that the elements cover the same range,  
but it could be different. For example, an <a> could cover only part of a  
<li> in your example above, or <a> in a gallery item could include both a  
thumbnail and a caption below that.

>  From a semantics point of view, the clickablility of an object and the  
> destination URI of that action is a property of the element itself, and  
> it makes much more sense to me to use an attribute, rather than a  
> separate element, for these sorts of cases.

"Clickability" is presentational/behavioral. "Destination URI" has  
different semantic meaning when applied to different elements, and no  
meaning at all when applied to some (e.g. <input>).

Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com

More information about the whatwg mailing list