From 55577c59a20929cec65ef0c866e59913015c9966 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 26 Nov 2012 16:09:50 -0500 Subject: [PATCH] Be more d3y --- js/iD/id.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/js/iD/id.js b/js/iD/id.js index f17a5eba7..b870ba419 100644 --- a/js/iD/id.js +++ b/js/iD/id.js @@ -82,17 +82,12 @@ var iD = function(container) { }); var zoom = bar.append('div') - .attr('class', 'zoombuttons'); - - zoom.append('button') - .attr('class', 'zoom-in') - .text('+') - .on('click', map.zoomIn); - - zoom.append('button') - .attr('class', 'zoom-out') - .text('–') - .on('click', map.zoomOut); + .attr('class', 'zoombuttons') + .selectAll('button') + .data([['zoom-in', '+', map.zoomIn], ['zoom-out', '-', map.zoomOut]]) + .enter().append('button').attr('class', function(d) { return d[0]; }) + .text(function(d) { return d[1]; }) + .on('click', function(d) { return d[2](); }); container.append('div') .attr('class', 'inspector-wrap');