W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2005

[whatwg] [WA1] The a element could be empty

From: Simon Pieters <zcorpan@hotmail.com>
Date: Fri, 02 Sep 2005 17:38:52 +0000
Message-ID: <BAY109-F173441DBC262C5C110FC8B4A30@phx.gbl>
Hi,

>Since that's not actually a link (the href points to the javascript: URL 
>scheme which is an ugly hack), what's wrong with:
>
><span id="print" class="link"></span>

How is an empty span less harmful than an empty a element without an href 
attribute?

>Where the link class may be styled to look like a link with CSS, and then
>
>var elm = document.getElementById("print");
>elm.onclick = window.print;
>elm.appendChild(document.createTextNode("Print this page"));

For keyboard access, you need a tabindex="0" which has no effect in legacy 
UAs, and you currently can't trigger the click event from keyboard in IE6 or 
Firefox on a span element.

The javascript: URI scheme is a separate issue. If we replace the href with 
"http://example.org/" -- or "mailto:me at example.org", or "data:,foo", or 
whatever -- in my first example, I would still like to use an empty a 
element in the markup.

Regards,
Simon Pieters
Received on Friday, 2 September 2005 10:38:52 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:42 UTC