Šime,

Sorry, but I agree with Scott for the most part.

On Jan 1, 2010, at 10:55 AM, Šime Vidas wrote:
So, you are:

1. going against the standard (misusing the A)

Easily solved by adding a hash identifier:

     <p><a id="slick-toggle" href="#content1">More Details</a></p>
     <div id="content1">
       <p>Additional content</p>
       <p>More additional content</p>
       <p>Still more additional content</p>
     </div>

Now it's a perfectly acceptable use.

2. setting an invalid URI to the href attribute

I'm having a hard time finding that in the spec. Can you provide a link? (that's a genuine request.) Anyway, you're inflating the number of "problems" here. Numbers 1 and 2 should be a single item.

3. doing 2 additional steps (setting href and returning false in
handler)

too "lazy"? ;-) see your comment below.

4. taking the risk that you will at one occasion forget to return
false in the handler which would mess up the Back button for the user

Or call event.preventDefault()
It's a risk I'm willing to take.

just because you are to "lazy" (no offense) to put this in your CSS
code:

.slick-toggle { color:blue; text-decoration:underline; }
.slick-toggle:hover { cursor:pointer; }

But, chances are that you will have to style the slick-toggle class
anyway (because blue underlined text with everything else inherited
doesn't "bring it" anyway in most cases).

You've also overlooked an important reason for using an <a href="#foo"> (or a button) rather than a <span> or some other element: Keyboard accessibility. I suppose you could play around with tabindex attributes, but that gets thorny pretty quickly. Besides, at least according to the html 4.01 spec, only a limited set of elements support the tabindex attribute:

"The following elements support the tabindex attribute: A, AREA, BUTTON, INPUT, OBJECT, SELECT, and TEXTAREA."
http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex

(Seems some browsers actually support a broader set of elements, but I haven't investigated this much.)

So, with <span> elements you're left with no valid way to navigate to them and invoke them with a keyboard. That's a pretty serious limitation -- one that I think far outweighs the concerns that you've raised about <a href="#">.


--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to