title: JavaScript sort is duplicating results
body: <p>I have a really weird issue where JavaScript sort is duplicating the results.</p>
  
  <p>I am sorting a bunch of divs based on their data attributes depending on the user's choice. I should note that the divs in question are pulled into their container beforehand with ajax.</p>
  
  <pre><code>//sort flights
  function sortFlights(sortBy) {
  
      var flightDivs = $(".flight-result");
  
      if(sortBy == "journey") {
          var sortedFlights = flightDivs.sort(function(a, b){
              return $(a).data("journey")-$(b).data("journey");
          });
      }
      else if(sortBy == "depart") {
          var sortedFlights = flightDivs.sort(function(a, b){
              return $(a).data("departure")-$(b).data("departure");
          });
      }
      else if(sortBy == "arrive") {
          var sortedFlights = flightDivs.sort(function(a, b){
              return $(a).data("arrival")-$(b).data("arrival");
          });
      }
      else {
          var sortedFlights = flightDivs.sort(function(a, b){
              return $(a).data("price")-$(b).data("price");
          });
      }
  
      $(".flight-result").remove();
      $("#flights-results").append(sortedFlights);
  }
  </code></pre>
  
  <p>Here is an example of one of the divs I am sorting:</p>
  
  <pre><code>    &lt;div class="flight-result" data-price="127.02" 
  data-departure="20161214115500" data-arrival="20161214160000" 
  data-stops="0" data-journey="000305"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>The sort is working correctly, however the results come back twice, for example if I have 1,2,3,4,5 it is returning 1,1,2,2,3,3,4,4,5,5</p>
  
  <p>Has anyone seen this issue before?</p>