From 4333952081a5456c7937a844a1b4e90dc946cbdc Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 18 Jul 2013 14:33:00 -0500 Subject: [PATCH] fix recursion in Form object. --- lib/widget.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index ee2bf1e..0ebc8a3 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -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'); };