diff --git a/js/id/modes/draw_road.js b/js/id/modes/draw_road.js index 56058e017..81f00a0cf 100644 --- a/js/id/modes/draw_road.js +++ b/js/id/modes/draw_road.js @@ -4,6 +4,7 @@ iD.modes.DrawRoad = function(wayId, direction) { }; mode.enter = function() { + var map = mode.map, history = mode.history, controller = mode.controller, diff --git a/js/id/modes/select.js b/js/id/modes/select.js index 4a704652b..02553663d 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -53,7 +53,7 @@ iD.modes.Select = function (entity) { mode.enter = function () { iD.modes._dragFeatures(mode); - target = mode.map.surface.selectAll("*") + target = mode.map.surface.selectAll('*') .filter(function (d) { return d === entity; }); d3.select('.inspector-wrap') @@ -88,7 +88,7 @@ iD.modes.Select = function (entity) { target.call(dragWay); } - mode.map.surface.on("click.browse", function () { + mode.map.surface.on('click.browse', function () { var datum = d3.select(d3.event.target).datum(); if (datum instanceof iD.Entity) { mode.controller.enter(iD.modes.Select(datum)); @@ -116,7 +116,7 @@ iD.modes.Select = function (entity) { .on('touchstart.drag', null); } - mode.map.surface.on("click.browse", null); + mode.map.surface.on('click.browse', null); mode.map.keybinding().on('⌫.browse', null); mode.map.selection(null); diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index f83e5487a..61e9b7069 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -33,8 +33,8 @@ iD.Map = function() { .call(zoom); surface = supersurface.append('svg') - .on('mouseup', resetTransform) - .on('touchend', resetTransform); + .on('mouseup.reset-transform', resetTransform) + .on('touchend.reset-transform', resetTransform); defs = surface.append('defs'); defs.append('clipPath') diff --git a/js/id/ui/commit.js b/js/id/ui/commit.js index e5f3de828..40a6a2e98 100644 --- a/js/id/ui/commit.js +++ b/js/id/ui/commit.js @@ -40,14 +40,14 @@ iD.commit = function() { body.append('button').text('Save') .attr('class', 'save') - .on('click', function() { + .on('click.save', function() { event.save({ comment: d3.select('textarea.changeset-comment').node().value }); }); body.append('button').text('Cancel') .attr('class', 'cancel') - .on('click', function() { + .on('click.cancel', function() { event.cancel(); }); } diff --git a/js/id/ui/confirm.js b/js/id/ui/confirm.js index b0ea340d9..dbddae9db 100644 --- a/js/id/ui/confirm.js +++ b/js/id/ui/confirm.js @@ -6,7 +6,7 @@ iD.confirm = function(message) { modal.select('.content') .append('button') .text('OK') - .on('click', function() { + .on('click.confirm', function() { modal.remove(); }); diff --git a/js/id/ui/layerswitcher.js b/js/id/ui/layerswitcher.js index ae0d313ff..14c6bb142 100644 --- a/js/id/ui/layerswitcher.js +++ b/js/id/ui/layerswitcher.js @@ -72,7 +72,7 @@ iD.layerswitcher = function(map) { .attr('data-original-title', function(d) { return d.label + " opacity"; }) - .on('click', function(d) { + .on('click.set-opacity', function(d) { d3.select('#tile-g') .transition() .style('opacity', d.level) @@ -116,7 +116,7 @@ iD.layerswitcher = function(map) { return d.name; }) .call(bootstrap.tooltip().placement('right')) - .on('click', function(d) { + .on('click.set-source', function(d) { d3.event.preventDefault(); map.background.source(d.source); map.redraw(); diff --git a/js/id/ui/modal.js b/js/id/ui/modal.js index 6b74504c8..f4ad5ea01 100644 --- a/js/id/ui/modal.js +++ b/js/id/ui/modal.js @@ -7,7 +7,7 @@ iD.modal = function() { var shaded = d3.select(document.body) .append('div').attr('class', 'shaded') .style('opacity', 0) - .on('click', function() { + .on('click.remove-modal', function() { if (d3.event.target == this) this.remove(); }); diff --git a/js/id/ui/userpanel.js b/js/id/ui/userpanel.js index 1904e0a7c..6c126898a 100644 --- a/js/id/ui/userpanel.js +++ b/js/id/ui/userpanel.js @@ -19,7 +19,7 @@ iD.userpanel = function(connection) { .attr('class', 'logout') .attr('href', '#') .text('logout') - .on('click', function() { + .on('click.logout', function() { d3.event.preventDefault(); event.logout(); });