From 6740193eed7dcf0df2834d6f134987304de48c97 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Tue, 19 Nov 2013 13:54:14 +0000 Subject: [PATCH] Dev fix: The API chaining was a little broken if the inner function returned undefined, null etc. - The base issue was in the instanceof check which has a priority error, it was: ! obj instanceof _Api which is the same as: (! obj) instanceof _Api which is rubbish. We want: ! (obj instanceof _Api) but there is of course a wrapper function, so that needs ot be taken into account as well. The new logic does just that. --- .datatables-commit-sync | 2 +- media/js/jquery.dataTables.js | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.datatables-commit-sync b/.datatables-commit-sync index db20b22a..dea47d5c 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -39706899b20912b09581cc44ef838d469ab4e2fa +c45d7a00a9cb9889d6782276fb21e8c7d2f121e8 diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index aa86b577..476c0e09 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -6657,14 +6657,15 @@ _Api.extend = function ( scope, obj, ext ) { - if ( ! obj instanceof _Api ) { + // Only extend API instances and static properties of the API + if ( ! obj || ( ! (obj instanceof _Api) && ! obj.__dt_wrapper ) ) { return; } var i, ien, j, jen, - struct, + struct, inner, methodScoping = function ( fn, struc ) { return function () { var ret = fn.apply( scope, arguments ); @@ -6677,14 +6678,14 @@ for ( i=0, ien=ext.length ; i