Why does $('#id') return true if id doesn't exist?
<p>I always wondered why jQuery returns true if I'm trying to find elements by id selector that doesnt exist in the DOM structure.</p>

<p>Like this:</p>

<pre><code>&lt;div id="one"&gt;one&lt;/div&gt;

&lt;script&gt;
    console.log( !!$('#one') ) // prints true
    console.log( !!$('#two') ) // is also true! (empty jQuery object)
    console.log( !!document.getElementById('two') ) // prints false
&lt;/script&gt;
</code></pre>

<p>I know I can use <code>!!$('#two').length</code> since length === 0 if the object is empty, but it seems logical to me that a selector would return the element if found, otherwise <code>null</code> (like the native <code>document.getElementById</code> does).</p>

<p>F.ex, this logic can't be done in jQuery:</p>

<pre><code>var div = $('#two') || $('&lt;div id="two"&gt;&lt;/div&gt;');
</code></pre>

<p>Wouldnt it be more logical if the ID selector returned null if not found?</p>

<p>anyone?</p>
