From 261fa819d726db147ece62bbf838fbb4d53c1970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 8 Mar 2011 17:09:13 +0000 Subject: [PATCH] Change Bootstrap.js to only make beans if gettes has no function parameters defined, in order to avoid beans for functions that start with get but expect arguments when called. --- lib/bootstrap.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/bootstrap.js b/lib/bootstrap.js index 7405e72d..c77e7ade 100644 --- a/lib/bootstrap.js +++ b/lib/bootstrap.js @@ -111,7 +111,12 @@ var Base = this.Base = new function() { return val.valueOf(); } } - if (beans && (bean = name.match(/^(get|is)(([A-Z])(.*))$/))) + // Only add getter beans if they do not expect arguments + // Functions that should function both with optional + // arguments and as beans should not declare the parameters + // and use the arguments array internally instead. + if (beans && val.length == 0 + && (bean = name.match(/^(get|is)(([A-Z])(.*))$/))) beans.push([ bean[3].toLowerCase() + bean[4], bean[2] ]); } if (!res || func || !res.get && !res.set)