[whatwg] href on any element

Ric Hardacre whatwg at cycloid.f9.co.uk
Tue Aug 29 01:02:17 PDT 2006

Ian Hickson wrote:
> On Mon, 28 Aug 2006, Anne van Kesteren wrote:
>> On Mon, 28 Aug 2006 11:33:43 +0200, Lachlan Hunt <lachlan.hunt at lachy.id.au>
>> wrote:
>>>> It's arguably a very minor improvement,
>>> The only benefit I'm aware of is the convenience it provides to authors for
>>> hand coding, but that benefit is negligible when you consider the abilities
>>> of many authoring tools these days.
>> Another thing that some author seem to want is to make an entire block a link,
>> including its header and footer. Currently such things are solved with markup
>> similar to:
>>  <a href="">
>>   <span class="header"></span>
>>   <span class="text"></span>
>>  </a>
> ...or the currently non-conforming:
>    <a href="">
>     <h2>...</h2>
>     <p>...</p>
>    </a>
> We could make it conforming, I guess. The parser already supports it to 
> some extent.

I've run up against this before, the only way you can get it to conform
is by repeating the anchor:

<h2><a href="..." title="..." rel="etc.">Foo</a></h2>
<p><a href="..." title="..." rel="etc.">Bar</a></p>

or by the previous, non semantic use of spans. All that is required is
to allow the anchor to be used around block level elements. The anchor
could be treated as a non element, where any plain text within is by
default treated as inline. after all it's fine to surround some
inline-replaced elements such as images with A but not others, such as
inputs (though why anyone would want to do the latter is open to debate.)

this could also lead to clearer use of named anchors too, if they were
allowed to

1. surround the entire region they refer to
2. nest

<a name="appendix_1">
	<h2>Appendix 1</h2>
	<a name="ref_1"><p>1. <cite>...</cite> <em>...</em></p></a>
	<a name="ref_2"><p>...</p></a>

Question is, is this backwards compatible? do existing UAs treat this as
 a series of <a></a> tag pairs or does the nesting break it? If a
named-anchor surrounded it's region it would also allow screen readers
(for example) to very easily jump to a footnote and read it without
having to guess where to stop and return to the main text.

Ric Hardacre

More information about the whatwg mailing list