mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
Make sure there are no parameters before trying nice check for function name
This commit is contained in:
parent
878dc659b1
commit
5a1f642ce2
@ -125,25 +125,24 @@
|
||||
|
||||
// Check to see if it's referring to an existing function with no arguments specified.
|
||||
// If so, bind context & use it directly
|
||||
var parts = _code.split(".");
|
||||
var existing_func = parts.pop();
|
||||
var parent = _widget.egw().window;
|
||||
for(var i=0; i < parts.length; ++i)
|
||||
if(_code.indexOf("(") === -1)
|
||||
{
|
||||
if (typeof parent[parts[i]] !== "undefined")
|
||||
{
|
||||
parent = parent[parts[i]];
|
||||
var parts = _code.split(".");
|
||||
var existing_func = parts.pop();
|
||||
var parent = _widget.egw().window;
|
||||
for (var i = 0; i < parts.length; ++i) {
|
||||
if (typeof parent[parts[i]] !== "undefined") {
|
||||
parent = parent[parts[i]];
|
||||
}
|
||||
// Nope
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Nope
|
||||
else
|
||||
{
|
||||
break;
|
||||
if (typeof parent[existing_func] === "function") {
|
||||
return parent[existing_func].bind(context);
|
||||
}
|
||||
}
|
||||
if (typeof parent[existing_func] === "function")
|
||||
{
|
||||
return parent[existing_func].bind(context);
|
||||
}
|
||||
|
||||
// Generate the function itself, if it fails, log the error message and
|
||||
// return a function which always returns false
|
||||
|
Loading…
Reference in New Issue
Block a user