diff --git a/js/dataTables.select.js b/js/dataTables.select.js index 6baa473..32dd9c1 100644 --- a/js/dataTables.select.js +++ b/js/dataTables.select.js @@ -324,6 +324,7 @@ function enableMouseSelection ( dt ) var container = $( dt.table().container() ); var ctx = dt.settings()[0]; var selector = ctx._select.selector; + var matchSelection; container .on( 'mousedown.dtSelect', selector, function(e) { @@ -336,6 +337,10 @@ function enableMouseSelection ( dt ) return false; } ); } + + if ( window.getSelection ) { + matchSelection = window.getSelection(); + } } ) .on( 'mouseup.dtSelect', selector, function() { // Allow text selection to occur again, Mozilla style (tested in FF @@ -354,7 +359,7 @@ function enableMouseSelection ( dt ) // If the element that contains the selection is not in the table, we can ignore it // This can happen if the developer selects text from the click event if ( ! selection.anchorNode || $(selection.anchorNode).closest('table')[0] === dt.table().node() ) { - if ( $.trim(selection.toString()) !== '' ) { + if ( selection !== matchSelection ) { return; } }