From 4a65fb054aae047f8c211a8cf05061b02bb35cb2 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Sun, 5 Jan 2014 11:17:53 +0000 Subject: [PATCH] Update: `isDataTable()` static method will now accept jQuery objects and selectors as a parameter to check if it is a dataTable. `tables()` static method rewritten for size --- .datatables-commit-sync | 2 +- media/js/jquery.dataTables.js | 34 +++++++++++++++------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.datatables-commit-sync b/.datatables-commit-sync index 08135c1b..d96d2c3e 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -2baec538cb6391e8e14a53c0d194b4b396e5600e +430d445673a4d7344a1888b453d9dd1a46f9129c diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index c8a9361e..8d41b2a5 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -8377,30 +8377,30 @@ /** * Check if a `` node is a DataTable table already or not. * - * @param {node} table The `table` node to check if it is a DataTable or not - * (note that other node types can be passed in, but will always return - * false). + * @param {node|jquery|string} table Table node, jQuery object or jQuery + * selector for the table to test. Note that if more than more than one + * table is passed on, only the first will be checked * @returns {boolean} true the table given is a DataTable, or false otherwise * @static * @dtopt API-Static * * @example - * var ex = document.getElementById('example'); - * if ( ! $.fn.DataTable.isDataTable( ex ) ) { - * $(ex).dataTable(); + * if ( ! $.fn.DataTable.isDataTable( '#example' ) ) { + * $('#example').dataTable(); * } */ DataTable.isDataTable = DataTable.fnIsDataTable = function ( table ) { - var o = DataTable.settings; + var t = $(table).get(0); + var is = false; - for ( var i=0 ; i