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

Simon Pieters zcorpan at hotmail.com
Fri Sep 2 10:38:52 PDT 2005


>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 

>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.

Simon Pieters

More information about the whatwg mailing list