- From: Jim Ley <jim.ley@gmail.com>
- Date: Sat, 3 Sep 2005 16:14:34 +0100
On 9/3/05, Simon Pieters <zcorpan at hotmail.com> wrote: > |If the a element has no href attribute, then the element is a placeholder > |for where a link might otherwise have been placed, if it had been relevant. > > Why must a placeholder have contents? because a link requires contents. There's no need for empty a elements, they add nothing that an author cannot otherwise do. > I merely want a blank <a/> to be allowed, if > the href attribute is not set. You've only provided one use case, and it's not a good use case, as you can just as easily create the a element as have it in the source in the first place, it's much better to do that. > I don't want to hide it, I want it to be non existent when scripting is > disabled or non-supported. It's not non-existent though, it's there... > >4) What prevents you from inserting the entire <a> element into a <span>? > > It's more code, and an empty <a/> is IMHO equally harmful as an empty > <span/>, so I can use the a element directly. There's no need for an empty SPAN, you don't need any empty elements at all, there is almost no more code (a createElement and appendChild instead of a gEBI) and it's much neater, that's certainly not enough of a difference to make a difference. > | <p>Sample code: <a id="sel"></a> <textarea>...</textarea></p> > | <script> > | var elm = document.getElementById("sel"); > | elm.appendChild(document.createTextNode("select all")); > | elm.href = "javascript:selectall()"; > | function selectall(){...} > | </script> No, please stop suggesting href="javascript: this shows you're scripting experience is quite limited, the above fails in a number of browsers simply because the href: will result in a navigation, even if a null navigation which will unselect the text anyway. The total length of the code withotut the a in the source is also shorter, so this is not a use case. Jim.
Received on Saturday, 3 September 2005 08:14:34 UTC