diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js index 53d10412b..8df84f065 100644 --- a/components/zotero-protocol-handler.js +++ b/components/zotero-protocol-handler.js @@ -192,9 +192,9 @@ function ZoteroProtocolHandler() { var mimeType, content = ''; var items = []; var itemsHash = {}; // key = itemID, val = position in |items| - var searchItemIDs = {}; // hash of all selected items - var searchParentIDs = {}; // hash of parents of selected child items - var searchChildIDs = {}; // hash of selected chlid items + var searchItemIDs = new Set(); // All selected items + var searchParentIDs = new Set(); // Parents of selected child items + var searchChildIDs = new Set() // Selected chlid items var includeAllChildItems = Zotero.Prefs.get('report.includeAllChildItems'); var combineChildItems = Zotero.Prefs.get('report.combineChildItems'); @@ -205,8 +205,8 @@ function ZoteroProtocolHandler() { // (instead mark their parents for inclusion below) var parentItemID = results[i].parentItemID; if (parentItemID) { - searchParentIDs[parentItemID] = true; - searchChildIDs[results[i].id] = true; + searchParentIDs.add(parentItemID); + searchChildIDs.add(results[i].id); // Don't include all child items if any child // items were selected @@ -223,14 +223,14 @@ function ZoteroProtocolHandler() { else { unhandledParents[i] = true; } - searchItemIDs[results[i].id] = true; + searchItemIDs.add(results[i].id); } // If including all child items, add children of all matched // parents to the child array if (includeAllChildItems) { - for (var id in searchItemIDs) { - if (!searchChildIDs[id]) { + for (let id of searchItemIDs) { + if (!searchChildIDs.has(id)) { var children = []; var item = yield Zotero.Items.getAsync(id); if (!item.isRegularItem()) { @@ -239,7 +239,7 @@ function ZoteroProtocolHandler() { var func = function (ids) { if (ids) { for (var i=0; i