fix recursion in Form object.
This commit is contained in:
parent
61653e3f19
commit
4333952081
|
@ -3331,7 +3331,7 @@ Form.prototype.submit = function() {
|
|||
var self = this
|
||||
, out = {};
|
||||
|
||||
(function get(el) {
|
||||
this.children.forEach(function fn(el) {
|
||||
if (el.value != null) {
|
||||
var name = el.name || el.type;
|
||||
if (Array.isArray(out[name])) {
|
||||
|
@ -3342,8 +3342,8 @@ Form.prototype.submit = function() {
|
|||
out[name] = el.value;
|
||||
}
|
||||
}
|
||||
el.children.forEach(get);
|
||||
})(this);
|
||||
el.children.forEach(fn);
|
||||
});
|
||||
|
||||
this.emit('submit', out);
|
||||
|
||||
|
@ -3355,7 +3355,7 @@ Form.prototype.cancel = function() {
|
|||
};
|
||||
|
||||
Form.prototype.reset = function() {
|
||||
(function clear(el) {
|
||||
this.children.forEach(function fn(el) {
|
||||
switch (el.type) {
|
||||
case 'screen':
|
||||
break;
|
||||
|
@ -3419,8 +3419,8 @@ Form.prototype.reset = function() {
|
|||
el.clearInput();
|
||||
return;
|
||||
}
|
||||
el.children.forEach(clear);
|
||||
})(this);
|
||||
el.children.forEach(fn);
|
||||
});
|
||||
|
||||
this.emit('reset');
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue