title: localeCompare not working correctly in Safari
body: <p>I'm using localeCompare to sort several columns of various alphanumeric data. One of the columns is money and localeCompare - in safari only - doesn't sort them correctly. This works in FF, Chrome and IE, but fails in Safari (and therefore IOS)</p>
  
  <p>Am I missing something? There's no error, it just returns the wrong results. I know I can write a custom sort function to handle it, but I was hoping there's a simpler solution...</p>
  
  <p>Example Fiddle here:
  <a href="https://jsfiddle.net/Chenzorama/pLav80Ly/" rel="nofollow">https://jsfiddle.net/Chenzorama/pLav80Ly/</a></p>
  
  <p>The HTML looks something like this:</p>
  
  <pre><code>&lt;div class="sortme"&gt;
    &lt;div class="somemoney"&gt;$10,231,000&lt;/div&gt;
    &lt;div class="somemoney"&gt;$18,000,000&lt;/div&gt;
    &lt;div class="somemoney"&gt;$18,500,030&lt;/div&gt;
    &lt;div class="somemoney"&gt;$8,765,000&lt;/div&gt;
    &lt;div class="somemoney"&gt;$100,000,000&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and the JS sort function I'm calling is this:</p>
  
  <pre><code> var units = $(".sortme .somemoney");
    units.detach().sort(function(a,b) {
      var aa = $(a).text();
      var bb = $(b).text();
      aa=aa.replace(/[,$]+/g, "").trim();
      bb=bb.replace(/[,$]+/g, "").trim();
      var updown = 0;
  
      if (sortDir == "ab") {
        updown = aa.localeCompare(bb, "en", {numeric: true});
      } else {
        updown = bb.localeCompare(aa, "en", {numeric: true});
      }
      return updown;
    });
  
    $(".sortme").append(units);
  </code></pre>
  
  <p>I tried stripping out the dollar sign and commas thinking those were the culprits but that didn't seem to solve the problem. </p>