From f28fa763ccfc5aac4575c1a2b28f532d84c89bf2 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 3 Dec 2024 15:32:19 -0500 Subject: [PATCH] DataTransfer#types: contains() -> includes() Not sure what this was before, but it's a standard read-only array now. Fixes #4893 --- chrome/content/zotero/collectionTree.jsx | 2 +- chrome/content/zotero/itemTree.jsx | 2 +- chrome/content/zotero/xpcom/zotero.js | 8 ++++---- test/tests/itemTreeTest.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/collectionTree.jsx b/chrome/content/zotero/collectionTree.jsx index 2524ed1267..b0f563f03f 100644 --- a/chrome/content/zotero/collectionTree.jsx +++ b/chrome/content/zotero/collectionTree.jsx @@ -1497,7 +1497,7 @@ var CollectionTree = class CollectionTree extends LibraryTree { // And everything else is a move this.setDropEffect(event, "move"); } - else if (event.dataTransfer.types.contains("application/x-moz-file")) { + else if (event.dataTransfer.types.includes("application/x-moz-file")) { // As of Aug. 2013 nightlies: // // - Setting the dropEffect only works on Linux and OS X. diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index 0bc062f0a4..8f1efbca8e 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -2122,7 +2122,7 @@ var ItemTree = class ItemTree extends LibraryTree { this.setDropEffect(event, "copy"); } } - else if (event.dataTransfer.types.contains("application/x-moz-file")) { + else if (event.dataTransfer.types.includes("application/x-moz-file")) { // As of Aug. 2013 nightlies: // // - Setting the dropEffect only works on Linux and OS X. diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 56df63db75..c1930482df 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -2035,18 +2035,18 @@ Zotero.DragDrop = { var len = firstOnly ? 1 : dt.mozItemCount; - if (dt.types.contains('zotero/collection')) { + if (dt.types.includes('zotero/collection')) { dragData.dataType = 'zotero/collection'; let ids = dt.getData('zotero/collection').split(",").map(id => parseInt(id)); dragData.data = ids; } - else if (dt.types.contains('zotero/item')) { + else if (dt.types.includes('zotero/item')) { dragData.dataType = 'zotero/item'; let ids = dt.getData('zotero/item').split(",").map(id => parseInt(id)); dragData.data = ids; } else { - if (dt.types.contains('application/x-moz-file')) { + if (dt.types.includes('application/x-moz-file')) { dragData.dataType = 'application/x-moz-file'; var files = []; for (var i=0; i