Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/ui/filters-filteractions.js

Issue 4884233277407232: Issue 2257 - Replaced non-standard function expressions with ES6 arrow functions (Closed)
Patch Set: 2nd argument to Utils.runAsync isn't necessary with arrow functions Created April 1, 2015, 5:47 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/content/ui/filters-filteractions.js
===================================================================
--- a/chrome/content/ui/filters-filteractions.js
+++ b/chrome/content/ui/filters-filteractions.js
@@ -101,9 +101,9 @@
fillActionsPopup: function()
{
let editable = FilterView.editable;
- let items = FilterView.selectedItems.filter(function(i) !i.filter.dummy);
- items.sort(function(entry1, entry2) entry1.index - entry2.index);
- let activeItems = items.filter(function(i) i.filter instanceof ActiveFilter);
+ let items = FilterView.selectedItems.filter(i => !i.filter.dummy);
+ items.sort((entry1, entry2) => entry1.index - entry2.index);
+ let activeItems = items.filter(i => i.filter instanceof ActiveFilter);
E("filters-edit-command").setAttribute("disabled", !editable || !items.length);
E("filters-delete-command").setAttribute("disabled", !editable || !items.length);
@@ -142,7 +142,7 @@
if (this.treeElement.editingColumn)
return;
- let items = FilterView.selectedItems.filter(function(i) i.filter instanceof ActiveFilter);
+ let items = FilterView.selectedItems.filter(i => i.filter instanceof ActiveFilter);
if (items.length)
{
FilterView.boxObject.beginUpdateBatch();
@@ -205,7 +205,7 @@
deleteItems: function(/**Array*/ items)
{
let oldIndex = FilterView.selection.currentIndex;
- items.sort(function(entry1, entry2) entry2.index - entry1.index);
+ items.sort((entry1, entry2) => entry2.index - entry1.index);
for (let i = 0; i < items.length; i++)
FilterStorage.removeFilter(items[i].filter, FilterView._subscription, items[i].index);
@@ -236,9 +236,9 @@
if (this.treeElement.editingColumn)
return;
- let items = FilterView.selectedItems.filter(function(i) i.filter instanceof ActiveFilter);
+ let items = FilterView.selectedItems.filter(i => i.filter instanceof ActiveFilter);
if (items.length)
- FilterStorage.resetHitCounts(items.map(function(i) i.filter));
+ FilterStorage.resetHitCounts(items.map(i => i.filter));
},
/**
@@ -253,7 +253,7 @@
if (offset < 0)
{
- items.sort(function(entry1, entry2) entry1.index - entry2.index);
+ items.sort((entry1, entry2) => entry1.index - entry2.index);
let position = items[0].index + offset;
if (position < 0)
return;
@@ -264,7 +264,7 @@
}
else if (offset > 0)
{
- items.sort(function(entry1, entry2) entry2.index - entry1.index);
+ items.sort((entry1, entry2) => entry2.index - entry1.index);
let position = items[0].index + offset;
if (position >= FilterView.rowCount)
return;
@@ -408,8 +408,8 @@
if (!items.length)
return;
- items.sort(function(entry1, entry2) entry1.index - entry2.index);
- let text = items.map(function(i) i.filter.text).join(IO.lineBreak);
+ items.sort((entry1, entry2) => entry1.index - entry2.index);
+ let text = items.map(i => i.filter.text).join(IO.lineBreak);
Utils.clipboardHelper.copyString(text);
if (!keep && FilterView.editable && !this.treeElement.editingColumn)
@@ -465,8 +465,8 @@
if (!items.length)
return;
- items.sort(function(entry1, entry2) entry1.index - entry2.index);
- event.dataTransfer.setData("text/plain", items.map(function(i) i.filter.text).join(IO.lineBreak));
+ items.sort((entry1, entry2) => entry1.index - entry2.index);
+ event.dataTransfer.setData("text/plain", items.map(i => i.filter.text).join(IO.lineBreak));
this.dragItems = items;
event.stopPropagation();
},

Powered by Google App Engine
This is Rietveld