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

Shannon shannon at arc.net.au
Thu Feb 28 04:18:58 PST 2008

Markus Ernst wrote:
 > Anyway, why do you suggest a new attribute rather than making the 
existing href attribute global?
Because I think some current and depreciated tags still use href for a 
different purpose (<base> for one). A global attribute should be unique. 
I don't really mind what the attribute is called.

Anne van Kesteren wrote:
 > We have a FAQ entry on this -- quite common -- request:
 > Hope that helps!
I'm happy to see it's a common request but I really hope the FAQ entry 
doesn't represent a final decision. I strongly disagree with its 
conclusions, so I'll address each:

FAQ:     * It isn't backwards compatible with existing browsers.

Not entirely true. I quote from the same FAQ:
What about Microsoft and Internet Explorer?
HTML 5 is being developed with IE compatibility in mind. Support for 
many features can be simulated using JavaScript.

So 'backwards-compatibility', as defined by the same document, can be 
achieved by using javascript to walk the DOM and add 
'window.location(node.getAttribute('link'))' to the onclick handler of 
any nodes with a link attribute. I have done a very similar thing before 
to implement :hover on non-anchor elements in IE. Of course an author 
wouldn't have to use this new attribute at all so 
backwards-compatibility is the designers choice, not an issue with the 
proposed attribute.

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.

FAQ:      * It doesn't make sense for all elements, such as interactive 
elements like input and button, where the use of href would interfere 
with their normal function.

As long as the spec is clear about which actions take precedence then 
this is not an issue. The spec should assume that if an author puts a 
link on a form element then they are *deliberately* interfering with its 
normal function. Trying to protect authors/users from their own bad 
choices is a very 'Microsoft' way of thinking and not really appropriate 
for spec targetting web authors. There might be good reasons for doing 
this that are not immediately obvious.

FAQ:     * Browser vendors have reported that implementing it would be 
extremely complex.

I find this claim incredible. How is a global link/href any more 
difficult than the existing implementations of onmouseup/down/whatever? 
It's basically the same thing - only *simpler* (no scripting, events, 
bubbling, etc).

So on all counts I find the claims in the FAQ incorrect and urge the 
WHATWG and browser vendors to reconsider the inclusion of a global link 
or href attribute.


More information about the whatwg mailing list