1
positions_list = [
  "M.pharm", 
  "pharmaceutical sales", 
  "pharmacist", 
  "druggist", 
  "MPharm", 
  "pharmaceutical sales", 
  "pharmacist", 
  "druggist", 
  "MPharm"
];

Then with jQuery.unique(positions_list); I get this result in Google Chrome (56.X):

["M.pharm", "pharmaceutical sales", "pharmacist", "druggist", "MPharm"]

However the result in MS Edge is this:

["M.pharm", "pharmaceutical sales", "pharmacist", "druggist", "MPharm", "pharmaceutical sales", "pharmacist", "druggist", "MPharm"]

As you can see the result in MS Edge is the same as the original list. How can I de-duplicate list in MS Edge?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
primoz
  • 885
  • 3
  • 12
  • 32
  • I'd suggest raising this as a bug with jQuery if you can consistently reproduce it. – Rory McCrossan Feb 22 '17 at 08:27
  • what error you are getting ? – Viplock Feb 22 '17 at 08:28
  • @Viplock no errors, just the same result as the original. – primoz Feb 22 '17 at 08:31
  • 3
    Did you try what they suggest on this post ? [http://stackoverflow.com/questions/19962759/jquery-unique-function-not-working-properly](http://stackoverflow.com/questions/19962759/jquery-unique-function-not-working-properly) – Brent Boden Feb 22 '17 at 08:33
  • @BrentBoden life-saver! Because the description of the `unique` in the docs is gray, I totally missed it. With the custom function it works in both browsers. Thank you. – primoz Feb 22 '17 at 08:41

1 Answers1

0

As indicated by the jQuery.unique() doc (referenced by @Brian Graham in this answer, itself referenced by @Brent Boden in comments):

Description: Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.

Community
  • 1
  • 1
Pascal
  • 259
  • 1
  • 11
  • 27