fix recursion in Form object.

This commit is contained in:
Christopher Jeffrey 2013-07-18 14:33:00 -05:00
parent 61653e3f19
commit 4333952081
1 changed files with 6 additions and 6 deletions

View File

@ -3331,7 +3331,7 @@ Form.prototype.submit = function() {
var self = this var self = this
, out = {}; , out = {};
(function get(el) { this.children.forEach(function fn(el) {
if (el.value != null) { if (el.value != null) {
var name = el.name || el.type; var name = el.name || el.type;
if (Array.isArray(out[name])) { if (Array.isArray(out[name])) {
@ -3342,8 +3342,8 @@ Form.prototype.submit = function() {
out[name] = el.value; out[name] = el.value;
} }
} }
el.children.forEach(get); el.children.forEach(fn);
})(this); });
this.emit('submit', out); this.emit('submit', out);
@ -3355,7 +3355,7 @@ Form.prototype.cancel = function() {
}; };
Form.prototype.reset = function() { Form.prototype.reset = function() {
(function clear(el) { this.children.forEach(function fn(el) {
switch (el.type) { switch (el.type) {
case 'screen': case 'screen':
break; break;
@ -3419,8 +3419,8 @@ Form.prototype.reset = function() {
el.clearInput(); el.clearInput();
return; return;
} }
el.children.forEach(clear); el.children.forEach(fn);
})(this); });
this.emit('reset'); this.emit('reset');
}; };