diff --git a/index.html b/index.html
index 9a4e27c50..6f41d3f0e 100644
--- a/index.html
+++ b/index.html
@@ -48,7 +48,6 @@
-
diff --git a/js/id/id.js b/js/id/id.js
index 5c8fa442d..355f105db 100644
--- a/js/id/id.js
+++ b/js/id/id.js
@@ -95,6 +95,14 @@ window.iD = function () {
context.zoomIn = map.zoomIn;
context.zoomOut = map.zoomOut;
+ /* Background */
+ var backgroundSources = iD.data.imagery.map(iD.BackgroundSource.template);
+ backgroundSources.push(iD.BackgroundSource.Custom);
+
+ context.backgroundSources = function() {
+ return backgroundSources;
+ };
+
/* Presets */
var presets = iD.presets(context);
@@ -111,7 +119,7 @@ window.iD = function () {
var q = iD.util.stringQs(location.hash.substring(1)), detected = false;
if (q.layer) {
context.background()
- .source(_.find(iD.layers, function(l) {
+ .source(_.find(backgroundSources, function(l) {
if (l.data.sourcetag === q.layer) {
detected = true;
return true;
@@ -121,7 +129,7 @@ window.iD = function () {
if (!detected) {
context.background()
- .source(_.find(iD.layers, function(l) {
+ .source(_.find(backgroundSources, function(l) {
return l.data.name === 'Bing aerial imagery';
}));
}
diff --git a/js/id/renderer/layers.js b/js/id/renderer/layers.js
deleted file mode 100644
index 6ee525d63..000000000
--- a/js/id/renderer/layers.js
+++ /dev/null
@@ -1,2 +0,0 @@
-iD.layers = iD.data.imagery.map(iD.BackgroundSource.template);
-iD.layers.push(iD.BackgroundSource.Custom);
diff --git a/js/id/ui/background.js b/js/id/ui/background.js
index 69991430f..a0f0c04a7 100644
--- a/js/id/ui/background.js
+++ b/js/id/ui/background.js
@@ -2,7 +2,7 @@ iD.ui.Background = function(context) {
var event = d3.dispatch('cancel', 'save'),
opacities = [1, 0.5, 0];
- var layers = iD.layers;
+ var layers = context.backgroundSources();
function getSources() {
var ext = context.map().extent();
diff --git a/test/spec/renderer/background.js b/test/spec/renderer/background.js
index cdfb3239d..52c825d06 100644
--- a/test/spec/renderer/background.js
+++ b/test/spec/renderer/background.js
@@ -20,11 +20,6 @@ describe('iD.Background', function() {
expect(c.size([100, 100])).to.equal(c);
expect(c.size()).to.eql([100,100]);
});
-
- it('#source', function() {
- expect(c.source(iD.layers[0])).to.equal(c);
- expect(c.source()).to.equal(iD.layers[0]);
- });
});
describe('iD.BackgroundSource.Template', function() {