[whatwg] href attribute
colin at fontshop.com
Mon Mar 5 09:13:07 PST 2007
Cheers Matthew - That's probably the most sensible explanation possible.
Well done. I'm convinced.
Matthew Raymond wrote:
> 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
> 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.
More information about the whatwg