title: jQuery sort and appendTo not working in Internet Explorer and Safari
body: <p>I'm using the jQuery <code>sort</code> and <code>appendTo</code> functions to reorder a list of span tags based on their content.</p>
  
  <p>It should be pretty easy and is working perfectly in Firefox and Chrome but it doesn't work in Internet Explorer 11 and Safari 5 on windows, and I can't find the reason.</p>
  
  <p>The HTML:</p>
  
  <pre><code>&lt;div class="ube-all"&gt;
     &lt;div class="ube-article"&gt;
       &lt;span&gt;bbbb&lt;/span&gt;
     &lt;/div&gt;
     &lt;div class="ube-article"&gt;
       &lt;span&gt;aaaaa&lt;/span&gt;
     &lt;/div&gt;
     &lt;div class="ube-article"&gt;
       &lt;span&gt;ccc&lt;/span&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The jQuery script:</p>
  
  <pre><code>$(document).ready(function() {
    $('.ube-all .ube-article').sort(function(a,b){
      return $.trim($(a).find('span').eq(0).text())&gt;$.trim($(b).find('span').eq(0).text());
    }).appendTo('.ube-all');
  });
  </code></pre>
  
  <p>A jsFiddle here:</p>
  
  <p><a href="https://jsfiddle.net/nxsby7rs/" rel="nofollow">https://jsfiddle.net/nxsby7rs/</a></p>
  
  <p>Any idea?</p>