NIHVIVO-3274 Bug fix - Internet Explorer before 9 does not support Array.indexOf

This commit is contained in:
j2blake 2011-11-11 16:46:41 +00:00
parent b6251c5f85
commit 586bf6d01e

View file

@ -16,7 +16,8 @@
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* You provide: * You provide:
* p -- the DOM element that contains the template and the data. * p -- the DOM element that contains the template and the data.
* It also contains the autocomplete field. * It also contains the autocomplete field, with a status element and
* perhaps 1 or more excluded URIs
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
function proxyItemsPanel(panel, contextInfo) { function proxyItemsPanel(panel, contextInfo) {
@ -53,9 +54,12 @@ function proxyItemsPanel(panel, contextInfo) {
} }
this.removeItem = function(info) { this.removeItem = function(info) {
var idx = self.itemData.indexOf(info); var i;
if (idx != -1) { for (i = 0; i < self.itemData.length; i++) {
self.itemData.splice(idx, 1); if (self.itemData[i] === info) {
self.itemData.splice(i, 1);
break;
}
} }
self.displayItemData(); self.displayItemData();
} }