One of the more frequently cited features of the XHTML2 Working Draft is that the href
attribute now applies to every element. People generally seem to appreciate this as it appears simpler and saves several keystrokes. Even though one of the design goals of HTML5 is remaining backwards compatible people still suggest this on the WHATWG mailing list. There’s another reason for not doing it though; it actually makes things more complex. If you want every element to become like a
you wouldn’t just make href
a global attribute, but target
, ping
, rel
, media
, hreflang
and type
as well (attributes currently allowed in HTML5 on the a
element).
This makes all those other elements a little bit more complex, as suddenly they have a whole new bunch of attributes that apply to them. It also creates problem for the input
element as that already has a type
attribute of which the semantics are completely different. Similarly the form
element has a target
attribute related to submission and not related to linking. Which brings up a related point, namely that the a
element has some activation behavior by default. This activation behavior is basically triggered when you click the link or use some other mechanism to invoke it. Suddenly this applies to all elements. However, there are other elements that already have activation behavior: <input type=checkbox>
.
There are some problems we could solve though. Currently the a
element can only enclose other text level elements and there have been some use cases presented where people want to linkify paragraph like content such as a heading and a short introduction text (Noorderlicht has that for instance). The specified algorithm for HTML parsing supports putting the a
element around paragraph (block) level elements. It’s just the definition of the element that forbids this at the moment, but that should be fixable.