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: Thu, 01 Sep 2005 22:31:52 +0000
Message-ID: <BAY109-F338CD731DC7FF7DC70431DB4A00@phx.gbl>

The spec currently says[1]:

|The a element must not be empty.

I think it would be more useful if it was changed to:

|If the a element has an href attribute set, then the element must not be 

It is easier to use an empty a element as a placeholder to grab and use with 
scripts later on, for instance:

   <a id="print"></a>


   var elm = document.getElementById("print");
   elm.href = "javascript:window.print()";
   elm.appendChild(document.createTextNode("Print this page"));

...rather than to create the link with script from scratch.

Simon Pieters

[1] http://whatwg.org/specs/web-apps/current-work/#the-a
Received on Thursday, 1 September 2005 15:31:52 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:23 UTC