diff --git a/js/id/modes/select.js b/js/id/modes/select.js index 93bb991c1..ee218c743 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -4,7 +4,7 @@ iD.modes.Select = function(context, selection, initial) { button: 'browse' }; - var inspector = iD.ui.Inspector().initial(!!initial), + var inspector = iD.ui.Inspector(context).initial(!!initial), keybinding = d3.keybinding('select'), timeout = null, behaviors = [ @@ -84,7 +84,6 @@ iD.modes.Select = function(context, selection, initial) { if (entity) { inspector - .context(context) .presetData(context.connection().presetData()); context.container() diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js index b07f49814..8453de560 100644 --- a/js/id/ui/inspector.js +++ b/js/id/ui/inspector.js @@ -1,12 +1,11 @@ -iD.ui.Inspector = function() { +iD.ui.Inspector = function(context) { var event = d3.dispatch('changeTags', 'close', 'change'), presetData = iD.presetData(), initial = false, inspectorbody, entity, presetGrid, - tagEditor, - context; + tagEditor; function inspector(selection) { @@ -19,19 +18,17 @@ iD.ui.Inspector = function() { inspectorbody = selection.append('div') .attr('class', 'fillL'), - presetGrid = iD.ui.PresetGrid() + presetGrid = iD.ui.PresetGrid(context) .presetData(presetData) .entity(entity) - .context(context) .on('message', changeMessage) .on('choose', function(preset) { inspectorbody.call(tagEditor, preset); }); - tagEditor = iD.ui.TagEditor() + tagEditor = iD.ui.TagEditor(context) .presetData(presetData) .tags(entity.tags) - .context(context) .on('message', changeMessage) .on('changeTags', function() { event.changeTags(entity, inspector.tags()); @@ -74,10 +71,5 @@ iD.ui.Inspector = function() { return inspector; }; - inspector.context = function(_) { - context = _; - return inspector; - }; - return d3.rebind(inspector, event, 'on'); }; diff --git a/js/id/ui/preset.js b/js/id/ui/preset.js index 97b6ee9a3..eab66462b 100644 --- a/js/id/ui/preset.js +++ b/js/id/ui/preset.js @@ -1,7 +1,6 @@ -iD.ui.preset = function() { +iD.ui.preset = function(context) { var event = d3.dispatch('change', 'setTags'), taginfo = iD.taginfo(), - context, entity, type, hidden, @@ -151,8 +150,7 @@ iD.ui.preset = function() { if (d.type === 'address') { wrap.append('div') .attr('class', 'col9 preset-input', d) - .call(iD.ui.preset.address() - .context(context) + .call(iD.ui.preset.address(context) .on('change', key) .entity(entity)); } @@ -178,12 +176,6 @@ iD.ui.preset = function() { return clean(getTags()); }; - presets.context = function(_) { - if (!arguments.length) return context; - context = _; - return presets; - }; - presets.entity = function(_) { if (!arguments.length) return entity; entity = _; diff --git a/js/id/ui/preset/address.js b/js/id/ui/preset/address.js index 054d9647d..237694e38 100644 --- a/js/id/ui/preset/address.js +++ b/js/id/ui/preset/address.js @@ -1,7 +1,6 @@ -iD.ui.preset.address = function() { +iD.ui.preset.address = function(context) { var event = d3.dispatch('change'), - context, entity; function getStreets() { @@ -74,11 +73,5 @@ iD.ui.preset.address = function() { return address; }; - address.context = function(_) { - if (!arguments.length) return context; - context = _; - return address; - }; - return d3.rebind(address, event, 'on'); }; diff --git a/js/id/ui/presetgrid.js b/js/id/ui/presetgrid.js index a8d1e953f..77a836513 100644 --- a/js/id/ui/presetgrid.js +++ b/js/id/ui/presetgrid.js @@ -1,7 +1,6 @@ -iD.ui.PresetGrid = function() { +iD.ui.PresetGrid = function(context) { var event = d3.dispatch('choose', 'message'), entity, - context, presetData; function presetgrid(selection, preset) { @@ -171,19 +170,11 @@ iD.ui.PresetGrid = function() { return presetgrid; }; - presetgrid.context = function(_) { - if (!arguments.length) return context; - context = _; - return presetgrid; - }; - presetgrid.entity = function(_) { if (!arguments.length) return entity; entity = _; return presetgrid; }; - - return d3.rebind(presetgrid, event, 'on'); }; diff --git a/js/id/ui/tageditor.js b/js/id/ui/tageditor.js index 6394efb9e..cfd64bd4a 100644 --- a/js/id/ui/tageditor.js +++ b/js/id/ui/tageditor.js @@ -1,4 +1,4 @@ -iD.ui.TagEditor = function() { +iD.ui.TagEditor = function(context) { var event = d3.dispatch('changeTags', 'choose', 'close', 'message'), presetData = iD.presetData(), entity, @@ -7,8 +7,7 @@ iD.ui.TagEditor = function() { presetMatch, selection_, presetUI, - tagList, - context; + tagList; function tageditor(selection, preset) { @@ -88,15 +87,13 @@ iD.ui.TagEditor = function() { event.changeTags(); }); - presetUI = iD.ui.preset() - .context(context) + presetUI = iD.ui.preset(context) .entity(entity) .on('change', function(tags) { event.changeTags(); }); - tagList = iD.ui.Taglist() - .context(context) + tagList = iD.ui.Taglist(context) .on('change', function(tags) { event.changeTags(); }); @@ -175,10 +172,5 @@ iD.ui.TagEditor = function() { return tageditor; }; - tageditor.context = function(_) { - context = _; - return tageditor; - }; - return d3.rebind(tageditor, event, 'on'); }; diff --git a/js/id/ui/taglist.js b/js/id/ui/taglist.js index 88f60f7e1..2ac6dc9af 100644 --- a/js/id/ui/taglist.js +++ b/js/id/ui/taglist.js @@ -1,10 +1,9 @@ -iD.ui.Taglist = function() { +iD.ui.Taglist = function(context) { var event = d3.dispatch('change'), taginfo = iD.taginfo(), initial = false, collapsebutton, - list, - context; + list; function taglist(selection, expanded) { @@ -271,10 +270,5 @@ iD.ui.Taglist = function() { } }; - taglist.context = function(_) { - context = _; - return taglist; - }; - return d3.rebind(taglist, event, 'on'); }; diff --git a/test/spec/ui/inspector.js b/test/spec/ui/inspector.js index f572d77e0..2b075cd07 100644 --- a/test/spec/ui/inspector.js +++ b/test/spec/ui/inspector.js @@ -4,7 +4,7 @@ describe("iD.ui.Inspector", function () { entity, graph, context; function render() { - inspector = iD.ui.Inspector().context(context); + inspector = iD.ui.Inspector(context); element = d3.select('body') .append('div') .attr('id', 'inspector-wrap')