PDA

View Full Version : createInterceptor: (boolean) false as returnValue is not working



calinseciu
2 May 2011, 11:22 PM
Sencha Touch version tested:

1.1


Platform tested against:

all


Description:

Ext.util.Functions.createInterceptor doesn't work with (boolean) false as the returnValue


Test Case:



fn = Ext.util.Functions.createInterceptor(fn, otherFn, this, false);


Possible fix:


Ext.util.Functions.createInterceptor = function(origFn, newFn, scope, returnValue) {
var method = origFn;
if (!Ext.isFunction(newFn)) {
return origFn;
}
else {
return function() {
var me = this,
args = arguments;
newFn.target = me;
newFn.method = origFn;
return (newFn.apply(scope || me || window, args) !== false) ?
origFn.apply(me || window, args) :
(typeof returnValue == 'undefined' ? null : returnValue);
};
}
};