Make sure onclick callback functions (specified as app.appname.funcname, or a real function) get all parameters passed, and they always can have a reference to the responsible widget

This commit is contained in:
Nathan Gray 2013-07-19 12:36:59 +00:00
parent ae848ffaee
commit b7ad0d33f8

View File

@ -238,7 +238,11 @@ var et2_baseWidget = et2_DOMWidget.extend(et2_IAligned,
{
if(typeof this.onclick == 'function')
{
return this.onclick(_node);
// Make sure function gets a reference to the widget
var args = Array.prototype.slice.call(arguments);
if(args.indexOf(this) == -1) args.push(this);
return this.onclick.apply(this, args);
} else {
return (et2_compileLegacyJS(this.options.onclick, this, _node))();
}