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

Jonas Sicking jonas at sicking.cc
Mon Aug 4 11:21:01 PDT 2008


Jonas Sicking wrote:
> Ian Hickson wrote:
>> Every now and then, the issue of a global href="" attribute for all 
>> elements comes up. There are many valid use cases for this, like being 
>> able to make all cells in a table row act like a link, or making a 
>> banner ad act like a single block of a link.
>>
>> Unfortunately, I've been told over and over by implementers that a 
>> global href="" is a bad idea, and at the end of the day, the 
>> implementors are the ones who have the final say, so that's just a 
>> non-starter.
> 
> Which implementations have you heard this from? As far as mozilla goes 
> we would have no technical problems implementing this.
> 
> The problems that I can see are of a more 'social' type. I.e. how to 
> behave when two links are nested, or when a button is nested inside a 
> link. Or how the event model interacts with the navigation action.
> 
> All these problems exist already, but might become more common if it was 
> easier to sprinkle 'href' attributes throughout the DOM.

Actually, I think I spoke a bit too broadly.

Just adding support for the 'href' content attribute, and the ability to 
click and style those elements just like you can an <a> today should be 
easy, at least in gecko.

This is modulo the issue of what happens with the elements that already 
have a 'href' attribute with a different meaning (i.e. other than making 
the element into a clickable link), such as <base> and <link>

However if we want to add support for the long list of JS attributes 
that exist on <a> elements today on each and every HTML element I 
suspect that is going to get messier. Especially considering the 
collisions for <base> and <link>. What would myBaseElement.accessKey do? 
And is myDivElement.protocol really intuitive what it does?

However these are problems that can be solved on a spec level IMHO.

/ Jonas



More information about the whatwg mailing list