Replace all matches, not just the first one..

This commit is contained in:
Bryan Housel
2014-05-23 15:04:35 -04:00
parent 126f334c96
commit 1c3d0dacee

View File

@@ -32,7 +32,7 @@ iD.ui.preset.typeCombo = function(field) {
function options(opts) {
combobox.data(opts.map(function(d) {
var o = {};
o.title = o.value = d.replace('_', ' ');
o.title = o.value = d.replace(/_+/g, ' ');
return o;
}));
@@ -44,7 +44,7 @@ iD.ui.preset.typeCombo = function(field) {
}
function change() {
var value = input.value().replace(' ', '_');
var value = input.value().replace(/\s+/g, '_');
if (field.type === 'typeCombo' && !value) value = 'yes';
var t = {};