mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Add preventDefault on button clicks (fixes #1551)
This commit is contained in:
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user