diff --git a/index.html b/index.html
index fa957b991..9d9a1ed60 100644
--- a/index.html
+++ b/index.html
@@ -46,6 +46,7 @@
+
diff --git a/js/id/actions/reverse_way.js b/js/id/actions/reverse_way.js
index a6ba24518..ca3bd03e3 100644
--- a/js/id/actions/reverse_way.js
+++ b/js/id/actions/reverse_way.js
@@ -31,7 +31,7 @@ iD.actions.ReverseWay = function(wayId) {
var replacements = [
[/:right$/, ':left'], [/:left$/, ':right'],
[/:forward$/, ':backward'], [/:backward$/, ':forward']
- ], numeric = /^([+-]?)(?=[\d.])/;
+ ], numeric = /^([+\-]?)(?=[\d.])/;
function reverseKey(key) {
for (var i = 0; i < replacements.length; ++i) {
diff --git a/js/id/id.js b/js/id/id.js
index ee8775b56..cb0c5f82c 100644
--- a/js/id/id.js
+++ b/js/id/id.js
@@ -184,20 +184,9 @@ window.iD = function(container) {
return d[0] + ' icon';
});
- function geolocateSuccess(position) {
- map.center([position.coords.longitude, position.coords.latitude]);
- }
- function geolocateError() { }
if (navigator.geolocation) {
container.append('div')
- .attr('class', 'geolocate-control map-control')
- .append('button')
- .attr('class', 'narrow')
- .attr('title', 'Show My Location')
- .text('G')
- .on('click', function() {
- navigator.geolocation.getCurrentPosition(geolocateSuccess, geolocateError);
- });
+ .call(iD.geolocate(map));
}
var gc = container.append('div').attr('class', 'geocode-control map-control')
diff --git a/js/id/renderer/style.js b/js/id/renderer/style.js
index 99b346329..ccaa6a821 100644
--- a/js/id/renderer/style.js
+++ b/js/id/renderer/style.js
@@ -59,7 +59,7 @@ iD.Style.styleClasses = function() {
selection.each(function(d) {
var classes, value = this.className;
- if (value.baseVal != null) value = value.baseVal;
+ if (value.baseVal !== null) value = value.baseVal;
classes = value.trim().split(/\s+/).filter(function(name) {
return name.length && !tagClassRe.test(name);
diff --git a/js/id/ui/geolocate.js b/js/id/ui/geolocate.js
new file mode 100644
index 000000000..1d4e1a491
--- /dev/null
+++ b/js/id/ui/geolocate.js
@@ -0,0 +1,22 @@
+iD.geolocate = function(map) {
+
+ function success(position) {
+ map.center([position.coords.longitude, position.coords.latitude]);
+ }
+
+ function error() { }
+
+ return function(selection) {
+ selection
+ .attr('class', 'geolocate-control map-control')
+ .append('button')
+ .attr('class', 'narrow')
+ .attr('title', 'Show My Location')
+ .text('G')
+ .on('click', function() {
+ navigator.geolocation.getCurrentPosition(
+ success, error);
+ });
+ };
+
+};