Is there a shorter/more efficient way of writing this expression?
<p>I have a <code>nav</code> with some child <code>a</code>-elements. I added a click function to those elements, and want to know, which one was clicked. As there can be a <code>span</code> inside (but don't have to) the <code>a</code>-tag as well I used this code to get the index:</p>

<h3>HTML</h3>

<pre><code>&lt;nav&gt;
    &lt;a href=""&gt;&lt;span&gt;&lt;/span&gt;Link text&lt;/a&gt;
    &lt;a href=""&gt;&lt;span&gt;&lt;/span&gt;Link text&lt;/a&gt;
&lt;/nav&gt;
</code></pre>

<h3>JavaScript</h3>

<pre><code>var items = $('nav &gt; a');

items.click( function(event) {

    var target  = ( $(event.target).is('span') ? $(event.target).parent() : $(event.target) ); 
    var key     = items.index( target );

    console.log( key );

    event.preventDefault();
});
</code></pre>

<p>So my question is: Is there a better/short/faster way of writing this?</p>
