[whatwg] Proposal for a link attribute to replace <a href>

Robert O'Rourke rob at sanchothefat.com
Thu Feb 28 09:33:39 PST 2008

Paweł Stradomski wrote:
> W liście Shannon z dnia czwartek 28 lutego 2008:
>> FAQ:      * It adds no new functionality that can't already be achieved
>> using the a element.
>> Absolutely not true. A global attribute offers several features that <a>
>> does not - most importantly nested links and the ability to hyperlink
>> block and interactive elements without breaking validation.
> In my opinion this would be an important problem. How should nested links 
> work? Suppose I put href="http://a" on <p> element and href="http://b" on a 
> <span> inside that <p>. What should happen when the user clicks on that 
> <span>? That's the reason why nested <a>'s are forbidden by HTML 4 and
> XHTML 1.
> I'm not against href on every element, but then nesting elements with href 
> attribute should be forbidden. Similarly href should be forbidden on 
> interactive elements (buttons etc.), so making it global would be a problem.

I really like this idea too. I have no idea why anyone would want to 
nest links, whatever the parent element is.

I don't understand why buttons should not be allowed an href, obviously 
when the button or input is to submit a form (ie. explicitly having 
type="submit" as an attribute) it shouldn't be allowed but I'd find it 
useful where I've had to style a collection of links and inputs to be 
similar, for example the steps for a checkout process:

currently I have this:

<div class="steps">
	<a href="/basket.html" class="basket-step">Basket</span>
	<a href="/checkout.html" class="current checkout-step">Checkout</a>
	<input type="submit" class="confirm-step" value="Confirm" />
	<span class="payment-step">Payment</span>

but it could become:

<div class="steps">
	<input href="/basket.html" class="basket-step" value="Basket" />
	<input href="/checkout.html" class="current checkout-step" value="Checkout" />
	<input type="submit" class="confirm-step" value="Confirm" />
	<input type="button" disabled="disabled" class="payment-step" value="Payment" />

If I could use one (or at least fewer types) of elements it would make 
cross-browser styling easier. There are plenty of other places where I'd 
like to put an href on an input or button within a form. For example 
when performing sub-tasks via a query string before a form is submitted, 
I think a button is more appropriate than an anchor tag (which is 
normally associated with navigating to another page).

How web developers use it is up to them as always. It's up to the 
individual to use HTML appropriately so I think this would be a nifty 
addition to the repertoire.


More information about the whatwg mailing list