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.

This commit is contained in:
Jürg Lehni 2011-03-08 17:09:13 +00:00
parent ea9a1d2c47
commit 261fa819d7

7
lib/bootstrap.js vendored
View file

@ -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)