Add preventDefault on button clicks (fixes #1551)

This commit is contained in:
John Firebaugh
2013-05-30 15:45:09 -07:00
parent b37873538c
commit 814535ad34
2 changed files with 5 additions and 8 deletions
+4 -8
View File
@@ -20,13 +20,6 @@ iD.ui.preset.url = function(field) {
.on('blur', change)
.on('change', change);
function pm(elem, x) {
var num = elem.value ?
parseInt(elem.value, 10) : 0;
if (!isNaN(num)) elem.value = num + x;
change();
}
if (field.type == 'number') {
input.attr('type', 'text');
@@ -46,7 +39,10 @@ iD.ui.preset.url = function(field) {
spinControl.selectAll('button')
.on('click', function(d) {
pm(input.node(), d);
d3.event.preventDefault();
var num = parseInt(input.node().value || 0, 10);
if (!isNaN(num)) input.node().value = num + d;
change();
});
}
}
+1
View File
@@ -131,6 +131,7 @@ iD.ui.preset.localized = function(field, context) {
wrap.append('button')
.attr('class', 'minor button-input-action remove')
.on('click', function(d) {
d3.event.preventDefault();
var t = {};
t[key(d.lang)] = undefined;
event.change(t);