When to close custom build jQuery dropdown
<p>I made a very simple dropdown using a <code>&lt;div&gt;</code> (parent), <code>&lt;span&gt;</code> (current selection) and <code>&lt;ul&gt;</code> (options).
It works fine. What I now want to do is if the user clicks anywhere on the page, have it close, like a "real" <code>&lt;select&gt;</code> element.</p>

<p>What I do now is this:</p>

<pre><code>$(document).delegate('body','click',function(){
   if(isExpanded){close();}
});
</code></pre>

<p>And it works. What I am worried about is performance. Is it wise to listen for click events on the document node? Is there a better way?</p>

<p>Thank you.</p>
