Correctly trim whitespace in semicolon-separated multivalues #2236

This commit is contained in:
Bryan Housel
2014-05-23 15:06:10 -04:00
parent 1c3d0dacee
commit 40810dab04
2 changed files with 9 additions and 2 deletions
+3 -1
View File
@@ -133,11 +133,13 @@ iD.ui.EntityEditor = function(context) {
function clean(o) {
var out = {}, k, v;
/*jshint -W083 */
for (k in o) {
if (k && (v = o[k]) !== undefined) {
out[k] = v.trim();
out[k] = v.split(';').map(function(s) { return s.trim(); }).join(';');
}
}
/*jshint +W083 */
return out;
}
+6 -1
View File
@@ -44,7 +44,12 @@ iD.ui.preset.typeCombo = function(field) {
}
function change() {
var value = input.value().replace(/\s+/g, '_');
var value = input.value()
.split(';')
.map(function(s) { return s.trim(); })
.join(';')
.replace(/\s+/g, '_');
if (field.type === 'typeCombo' && !value) value = 'yes';
var t = {};