title: jQuery .filter() acts differently on a set with a single element
body: <p>I'm finding some really strange behavior of the filter function which I cannot work out. </p>
  
  <p>I have a list of table rows that have certain text in a custom data-filter attribute. A user types text into a text box and the page automatically filters the table rows using jQuery, based on what's in the data-filter attribute:</p>
  
  <pre><code>$('tbody &gt; tr').hide();
  
  var validTextElements = findMatchingTextRows($('tbody &gt; tr'));
  validTextElements.show();
  
  function findMatchingTextRows(elements) {
  
      var textFilterInput = $('#tb_text_filter').val();
      textFilterInput = textFilterInput.toLowerCase();
  
      return elements.filter('tr[data-filter*=\'' + textFilterInput + '\']');
  }
  </code></pre>
  
  <p>All works fine unless I have a table with one row in it. In this case, even when the user inputs an empty string (in which case I expect no filtering and the list to remain the same), <code>elements.filter('tr[data-filter*=\'' + textFilterInput + '\']')</code> returns an empty list, but when there are multiple items in <code>elements</code>, and the user inputs an empty string, the list remains the same. </p>
  
  <p>There seems no difference between the single element and multiple elements, if I have it working with multiple elements, then I delete all except one  from the HTML in Chrome developer tools, it stops working.</p>
  
  <p>Why could this be happening?</p>