diff --git a/core/misc/tabledrag.es6.js b/core/misc/tabledrag.es6.js index 29e8e03e6f..811834c21c 100644 --- a/core/misc/tabledrag.es6.js +++ b/core/misc/tabledrag.es6.js @@ -410,18 +410,16 @@ Drupal.tableDrag.prototype.rowSettings = function (group, row) { const field = $(row).find(`.${group}`); const tableSettingsGroup = this.tableSettings[group]; - return Object.keys(tableSettingsGroup).map((delta) => { + // Find the row settings for the target class. + const delta = Object.keys(tableSettingsGroup).find((delta) => { const targetClass = tableSettingsGroup[delta].target; - let rowSettings; - if (field.is(`.${targetClass}`)) { - // Return a copy of the row settings. - rowSettings = {}; - Object.keys(tableSettingsGroup[delta]).forEach((n) => { - rowSettings[n] = tableSettingsGroup[delta][n]; - }); - } - return rowSettings; - }).filter(rowSetting => rowSetting)[0]; + return field.is(`.${targetClass}`); + }); + // Return a copy of the row settings. + return Object.assign( + {}, + tableSettingsGroup[delta], + ); }; /** diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js index 3330aeb8bb..30a60b1557 100644 --- a/core/misc/tabledrag.js +++ b/core/misc/tabledrag.js @@ -213,19 +213,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol Drupal.tableDrag.prototype.rowSettings = function (group, row) { var field = $(row).find('.' + group); var tableSettingsGroup = this.tableSettings[group]; - return Object.keys(tableSettingsGroup).map(function (delta) { + + var delta = Object.keys(tableSettingsGroup).find(function (delta) { var targetClass = tableSettingsGroup[delta].target; - var rowSettings = void 0; - if (field.is('.' + targetClass)) { - rowSettings = {}; - Object.keys(tableSettingsGroup[delta]).forEach(function (n) { - rowSettings[n] = tableSettingsGroup[delta][n]; - }); - } - return rowSettings; - }).filter(function (rowSetting) { - return rowSetting; - })[0]; + return field.is('.' + targetClass); + }); + + return Object.assign({}, tableSettingsGroup[delta]); }; Drupal.tableDrag.prototype.makeDraggable = function (item) {