From 5f5e6a6f603075b0cffbb594f36d3e0d14434725 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Fri, 3 Sep 2010 08:39:16 +0100 Subject: [PATCH] Fixed: DataTables would unnecessarily add mousedown and selectstart event handlers to TH elements which aren't used for sorting. This is used on sorting columns to prevent text selection when clicking the element to perform sorting. --- media/js/jquery.dataTables.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 39e26891..f3e494ff 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -2790,18 +2790,18 @@ if ( oSettings.aoColumns[i].bSortable !== false ) { _fnSortAttachListener( oSettings, oSettings.aoColumns[i].nTh, i ); + + /* Take the brutal approach to cancelling text selection in header */ + $('th', oSettings.nTHead).mousedown( function (e) { + this.onselectstart = function() { return false; }; + return false; + } ); } else { $(oSettings.aoColumns[i].nTh).addClass( oSettings.oClasses.sSortableNone ); } } - - /* Take the brutal approach to cancelling text selection in header */ - $('th', oSettings.nTHead).mousedown( function (e) { - this.onselectstart = function() { return false; }; - return false; - } ); } /* Cache the footer elements */