From 8d4565114e66900f972e64f3a5131b125449b4fd Mon Sep 17 00:00:00 2001 From: portix Date: Mon, 10 Mar 2014 03:09:06 +0100 Subject: completion: use the _data-array index as data-id --- scripts/modules/completion | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/modules/completion b/scripts/modules/completion index f0f80cc0..344a27c6 100644 --- a/scripts/modules/completion +++ b/scripts/modules/completion @@ -110,7 +110,7 @@ function injectable() { textContent : tab.rightLabel || "", className : "label right" }); - element.dataset.id = tab.id; + element.dataset.id = i; return element; }); select(); @@ -196,14 +196,7 @@ Object.defineProperties(Completion.prototype, { _getSelected : { value : function() { var id = JSON.parse(mWidget.inject("return getSelected()")); - var item = null; - this._data.some(function(i) { - if (i.id == id) { - item = i; - return true - } - return false; - }); + var item = this._data[id]; if (item) { this.onSelected(item); } -- cgit v1.2.3