diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index ef5eabe77..ebb156761 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -1,5 +1,5 @@ iD.ui.Commit = function(context) { - var event = d3.dispatch('cancel', 'save'); + var dispatch = d3.dispatch('cancel', 'save'); function commit(selection) { var changes = context.history().changes(), @@ -22,7 +22,7 @@ iD.ui.Commit = function(context) { header.append('button') .attr('class', 'fr') - .on('click', event.cancel) + .on('click.commit', function() { dispatch.cancel(); }) .append('span') .attr('class', 'icon close'); @@ -119,7 +119,7 @@ iD.ui.Commit = function(context) { var saveButton = saveSection.append('button') .attr('class', 'action col6 button') .on('click.save', function() { - event.save({ + dispatch.save({ comment: commentField.node().value }); }); @@ -204,5 +204,5 @@ iD.ui.Commit = function(context) { } } - return d3.rebind(commit, event, 'on'); + return d3.rebind(commit, dispatch, 'on'); }; diff --git a/js/id/ui/success.js b/js/id/ui/success.js index 73d23fbe4..83ca2d730 100644 --- a/js/id/ui/success.js +++ b/js/id/ui/success.js @@ -1,5 +1,5 @@ iD.ui.Success = function(context) { - var event = d3.dispatch('cancel'), + var dispatch = d3.dispatch('cancel'), changeset; function success(selection) { @@ -11,9 +11,9 @@ iD.ui.Success = function(context) { header.append('button') .attr('class', 'fr') + .on('click', function() { dispatch.cancel(); }) .append('span') - .attr('class', 'icon close') - .on('click', function() { event.cancel(success); }); + .attr('class', 'icon close'); header.append('h3') .text(t('success.just_edited')); @@ -55,5 +55,5 @@ iD.ui.Success = function(context) { return success; }; - return d3.rebind(success, event, 'on'); + return d3.rebind(success, dispatch, 'on'); };