[whatwg] href attribute

carmen wrote:
>> On Fri Mar 02, 2007 at 08:09:10PM +0100, David H?s?ther wrote:
>>> I don't see the href attribute specified anywhere but the a
>>> element in the current Web Applications spec. Is there interest
>>> in expanding actionable elements in this way?
> 
> definitely, as it facilitates the DRY principle of not repeating
> tags just to fulfll the browser's wishes of only having the href
> attribute on certain tags..

   In that case, why not make <abbr> an attribute:

| <li href="http://w3.org" abbr="World Wide Web Consortium">W3C</li>

   But why stop there? Can't there be a list of abbreviated italicized
headers with strong emphasis?...

| <li href="http://w3.org" h="1" i strong abbr="World Wide Web
| Consortium">W3C</li>

   The desire to save seven characters simply isn't sufficient,
especially when the disadvantages are just as great:

1) A full tag is more visible than just the attribute.

2) With DOM tools that represent the document as a tree with each
element as a node, you have to examine the properties of each node to
find the hyperlinks.

3) The structure of markup encourages people to view elements as having
stronger semantics than attributes. Therefore, converting <a href> into
just an attribute is a semantic demotion. (And if you don't think so,
consider this: <span href>.)

4) If you can't see the starting tag, and thus can't see its attributes,
then you don't know that the element and its contents are part of a
hyperlink, even if the end tag is visible.

5) Using just an attribute can cause restructuring of markup when you
need to add content to a hyperlink. Let's say you start with this:

| <abbr href="http://w3.org" title="World Wide Web Consortium">
|   W3C
| </abbr>

   Suppose you now want to add the word "Website" to the hyperlink:

| <span href="http://w3.org">
|   <abbr title="World Wide Web Consortium">W3C</abbr> Website
| </span>

   Notice that you had to add an element to accommodate the extra
content. If you had just used the <a> element, you'd only need to type
"Website". Thus a universal |href| attribute promotes fragile markup
structure.

6) Legacy browsers will ignore the hyperlink entirely if you use |href|
on elements other than <a>.

7) The ability to make block-level elements hyperlinks promotes bad UI,
because it makes it more difficult to perform operations like
highlighting and copying text, and because current web users are
unaccustomed to hyperlinks on such elements.

8) The attribute may cause confusion on some elements, such as <object>,
<blockquote>, et cetera. For example, would a web author know the
difference between |href| and |cite| on a <blockquote> element?

>> No, as this would not be backwards-compatible.
> 
> instead of the generic 'no'. can you implicate situations where a
> href tag on a non-'a' element confuses the browser?

   See #6 above.

Received on Friday, 2 March 2007 18:53:59 UTC