Remove dodgy use of $( array ).last()

Per the docs, these are only meant to be used on arrays of DOM elements.
jQuery might one day assign a different meaning to arrays of strings,
and then we could have some security issues or weird breakage.

(imported from commit 545eee1e9c6955556d5c4bda30cd6db0dce19c60)
This commit is contained in:
Keegan McAllister 2012-10-26 21:52:35 -04:00
parent 5c4fe1d521
commit c32b0a1a22
1 changed files with 2 additions and 1 deletions

View File

@ -434,7 +434,8 @@ $(function () {
items: 4,
matcher: function (item) {
// Assumes email addresses don't have commas or semicolons in them
var current_recipient = $(this.query.split(/[,;] */)).last()[0];
var recipients = this.query.split(/[,;] */);
var current_recipient = recipients[recipients.length-1];
// Case-insensitive (from Bootstrap's default matcher).
return (item.toLowerCase().indexOf(current_recipient.toLowerCase()) !== -1);
},