jquery-tablesorter 1.14.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/jquery-tablesorter/version.rb +1 -1
  4. data/vendor/assets/javascripts/jquery-tablesorter.js +1 -1
  5. data/vendor/assets/javascripts/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.js +5 -9
  6. data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.dragtable.mod.js +1 -4
  7. data/vendor/assets/javascripts/jquery-tablesorter/{jquery.metadata.js → extras/jquery.metadata.js} +1 -0
  8. data/vendor/assets/javascripts/jquery-tablesorter/extras/jquery.quicksearch.js +8 -4
  9. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js +116 -107
  10. data/vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.widgets.js +232 -171
  11. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-file-type.js +1 -1
  12. data/vendor/assets/javascripts/jquery-tablesorter/parsers/parser-input-select.js +1 -1
  13. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-chart.js +2 -3
  14. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-columns.js +78 -0
  15. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-cssStickyHeaders.js +14 -12
  16. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-editable.js +4 -4
  17. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter-formatter-html5.js +429 -0
  18. data/vendor/assets/javascripts/jquery-tablesorter/{jquery.tablesorter.widgets-filter-formatter.js → widgets/widget-filter-formatter-jui.js} +1 -381
  19. data/vendor/assets/javascripts/jquery-tablesorter/{jquery.tablesorter.widgets-filter-formatter-select2.js → widgets/widget-filter-formatter-select2.js} +0 -0
  20. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-filter.js +1307 -0
  21. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-formatter.js +3 -3
  22. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-grouping.js +4 -4
  23. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-math.js +3 -3
  24. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-pager.js +4 -8
  25. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-resizable.js +176 -0
  26. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-saveSort.js +68 -0
  27. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-staticRow.js +3 -3
  28. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-stickyHeaders.js +269 -0
  29. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-storage.js +76 -0
  30. data/vendor/assets/javascripts/jquery-tablesorter/widgets/widget-uitheme.js +184 -0
  31. data/vendor/assets/stylesheets/jquery-tablesorter/theme.black-ice.css +1 -1
  32. data/vendor/assets/stylesheets/jquery-tablesorter/theme.blue.css +1 -1
  33. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dark.css +1 -1
  34. data/vendor/assets/stylesheets/jquery-tablesorter/theme.default.css +1 -1
  35. data/vendor/assets/stylesheets/jquery-tablesorter/theme.dropbox.css +1 -1
  36. data/vendor/assets/stylesheets/jquery-tablesorter/theme.green.css +1 -1
  37. data/vendor/assets/stylesheets/jquery-tablesorter/theme.grey.css +1 -1
  38. data/vendor/assets/stylesheets/jquery-tablesorter/theme.ice.css +1 -1
  39. data/vendor/assets/stylesheets/jquery-tablesorter/theme.jui.css +1 -1
  40. data/vendor/assets/stylesheets/jquery-tablesorter/theme.metro-dark.css +1 -1
  41. metadata +15 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d8960dc57d66b1ac1b240f8ec2a50bcd85a130d
4
- data.tar.gz: 2ff7b825a32d597efe45f28ae8f52bc32a73f222
3
+ metadata.gz: 434be6c4bd88f3d84bbfaa574aa004a6db18abdb
4
+ data.tar.gz: 21eb848f7fd16cfb5642470af727a6fc858438c9
5
5
  SHA512:
6
- metadata.gz: 38e32b180cae97a545ddc52cf7f2f93fd5a5cf1a20d7a280b5a2e0cf2d7fcee64d0b9532ec17b9b63ff0a07ccfcdab5dc847171fe345bb883d818cd30c43938b
7
- data.tar.gz: 0054a4c0676789cccb11959b59aa81c2dceb4e33b46a58cf496915f9ea954e768f27b7956446bde7c25596d86938a2316a2a3b90a34492da4dfb7d3e359ac142
6
+ metadata.gz: cb3b3737c7de96e57b09385a612d5c1100125ffbd5c31007e1df38b563c7dbc7bc177dfcd958c8ffdb01a6a5ea24b857e8eacbe930d52547c80206b11fdf0b2f
7
+ data.tar.gz: 68cd1f4205072697210c3cacc18e078666bd9b1144b13968b944d30912f957530925f6d2a315cd7db2b2ec3475dccbb12931cfe8f030c150b21b35065c1847eb
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Simple integration of jquery-tablesorter into the asset pipeline.
6
6
 
7
- Current tablesorter version: 2.19.1 (2/9/2015), [documentation]
7
+ Current tablesorter version: 2.20.1 (2/20/2015), [documentation]
8
8
 
9
9
  Any issue associated with the js/css files, please report to [Mottie's fork].
10
10
 
@@ -24,7 +24,7 @@ Or install it yourself as:
24
24
 
25
25
  ## Requirements
26
26
 
27
- Rails 3.1 and higher (tested up to 4.2)
27
+ Rails 3.2 and higher (tested up to 4.2)
28
28
 
29
29
  Tested with ruby 1.9.3 - 2.2.0
30
30
 
@@ -1,3 +1,3 @@
1
1
  module JqueryTablesorter
2
- VERSION = '1.14.1'
2
+ VERSION = '1.15.0'
3
3
  end
@@ -1,3 +1,3 @@
1
- //= require jquery-tablesorter/jquery.metadata
1
+ //= require jquery-tablesorter/extras/jquery.metadata
2
2
  //= require jquery-tablesorter/jquery.tablesorter
3
3
  //= require jquery-tablesorter/jquery.tablesorter.widgets
@@ -135,18 +135,15 @@
135
135
  },
136
136
 
137
137
  calcFilters = function(table, p) {
138
- var tbodyIndex,
139
- c = table.config,
138
+ var c = table.config,
140
139
  hasFilters = c.$table.hasClass('hasFilters');
141
140
  if (hasFilters && !p.ajaxUrl) {
142
141
  if ($.isEmptyObject(c.cache)) {
143
142
  // delayInit: true so nothing is in the cache
144
143
  p.filteredRows = p.totalRows = c.$tbodies.eq(0).children('tr').not( p.countChildRows ? '' : '.' + c.cssChildRow ).length;
145
144
  } else {
146
- // just in case the pager tbody isn't the first tbody
147
- tbodyIndex = c.$table.children('tbody').index( c.$tbodies.eq(0) );
148
145
  p.filteredRows = 0;
149
- $.each(c.cache[tbodyIndex].normalized, function(i, el) {
146
+ $.each(c.cache[0].normalized, function(i, el) {
150
147
  p.filteredRows += p.regexRows.test(el[c.columns].$row[0].className) ? 0 : 1;
151
148
  });
152
149
  }
@@ -659,8 +656,7 @@
659
656
  c.$table.trigger('updateCache', [ function(){
660
657
  var i,
661
658
  rows = [],
662
- tbodyIndex = c.$table.children('tbody').index( c.$tbodies.eq(0) ),
663
- n = table.config.cache[tbodyIndex].normalized;
659
+ n = table.config.cache[0].normalized;
664
660
  p.totalRows = n.length;
665
661
  for (i = 0; i < p.totalRows; i++) {
666
662
  rows.push(n[i][c.columns].$row);
@@ -768,7 +764,7 @@
768
764
  table.config.appender = null; // remove pager appender function
769
765
  p.initialized = false;
770
766
  delete table.config.rowsCopy;
771
- $(table).unbind( $.trim(pagerEvents.split(' ').join('.pager ')) );
767
+ $(table).unbind( pagerEvents.split(' ').join('.pager ').replace(/\s+/g, ' ') );
772
768
  if (ts.storage) {
773
769
  ts.storage(table, p.storageKey, '');
774
770
  }
@@ -848,7 +844,7 @@
848
844
  p.regexRows = new RegExp('(' + (wo.filter_filteredRow || 'filtered') + '|' + c.selectorRemove.slice(1) + '|' + c.cssChildRow + ')');
849
845
 
850
846
  $t
851
- .unbind( $.trim(pagerEvents.split(' ').join('.pager ')) )
847
+ .unbind( pagerEvents.split(' ').join('.pager ').replace(/\s+/g, ' ') )
852
848
  .bind('filterInit.pager filterStart.pager', function(e, filters) {
853
849
  p.currentFilters = $.isArray(filters) ? filters : c.$table.data('lastSearch');
854
850
  // don't change page if filters are the same (pager updating, etc)
@@ -198,15 +198,12 @@
198
198
  }
199
199
  };
200
200
 
201
- /*!
202
- * dragtable
201
+ /*! dragtable v2.0.14 Mod *//*
203
202
  * _____ _
204
203
  * | |___ _| |
205
204
  * | | | | . | . |
206
205
  * |_|_|_|___|___|
207
206
  *
208
- * @Version 2.0.14 MOD
209
- *
210
207
  * Copyright (c) 2010-2013, Andres akottr@gmail.com
211
208
  * Dual licensed under the MIT (MIT-LICENSE.txt)
212
209
  * and GPL (GPL-LICENSE.txt) licenses.
@@ -92,6 +92,7 @@ $.extend({
92
92
 
93
93
  if ( data.indexOf( '{' ) <0 ) { data = "{" + data + "}"; }
94
94
 
95
+ /*jshint evil:true */
95
96
  data = eval("(" + data + ")");
96
97
 
97
98
  $.data( elem, settings.single, data );
@@ -32,7 +32,7 @@
32
32
  prepareQuery: function (val) {
33
33
  return val.toLowerCase().split(' ');
34
34
  },
35
- testQuery: function (query, txt, _row) {
35
+ testQuery: function (query, txt) {
36
36
  for (var i = 0; i < query.length; i += 1) {
37
37
  if (txt.indexOf(query[i]) === -1) {
38
38
  return false;
@@ -44,13 +44,13 @@
44
44
 
45
45
  this.go = function () {
46
46
 
47
- var i = 0,
47
+ var len, i = 0,
48
48
  numMatchedRows = 0,
49
49
  noresults = true,
50
50
  query = options.prepareQuery(val),
51
51
  val_empty = (val.replace(' ', '').length === 0);
52
52
 
53
- for (var i = 0, len = rowcache.length; i < len; i++) {
53
+ for (i = 0, len = rowcache.length; i < len; i++) {
54
54
  if (val_empty || options.testQuery(query, cache[i], rowcache[i]) ||
55
55
  ($(rowcache[i]).hasClass(options.childRow) && $(rowcache[i > 1 ? i - 1 : 0]).is(':visible'))) {
56
56
  options.show.apply(rowcache[i]);
@@ -125,7 +125,11 @@
125
125
 
126
126
  this.loader = function (bool) {
127
127
  if (typeof options.loader === "string" && options.loader !== "") {
128
- (bool) ? $(options.loader).show() : $(options.loader).hide();
128
+ if (bool) {
129
+ $(options.loader).show();
130
+ } else {
131
+ $(options.loader).hide();
132
+ }
129
133
  }
130
134
  return this;
131
135
  };
@@ -1,8 +1,10 @@
1
- /**!
2
- * TableSorter (FORK) 2.19.1 - Client-side table sorting with ease!
1
+ /*! TableSorter (FORK) v{{version}} *//*
2
+ * Client-side table sorting with ease!
3
3
  * @requires jQuery v1.2.6+
4
4
  *
5
5
  * Copyright (c) 2007 Christian Bach
6
+ * fork maintained by Rob Garrison
7
+ *
6
8
  * Examples and docs at: http://tablesorter.com
7
9
  * Dual licensed under the MIT and GPL licenses:
8
10
  * http://www.opensource.org/licenses/mit-license.php
@@ -11,8 +13,8 @@
11
13
  * @type jQuery
12
14
  * @name tablesorter (FORK)
13
15
  * @cat Plugins/Tablesorter
14
- * @author Christian Bach/christian.bach@polyester.se
15
- * @contributor Rob Garrison/https://github.com/Mottie/tablesorter
16
+ * @author Christian Bach - christian.bach@polyester.se
17
+ * @contributor Rob Garrison - https://github.com/Mottie/tablesorter
16
18
  */
17
19
  /*jshint browser:true, jquery:true, unused:false, expr: true */
18
20
  /*global console:false, alert:false, require:false, define:false, module:false */
@@ -32,7 +34,7 @@
32
34
 
33
35
  var ts = this;
34
36
 
35
- ts.version = '2.19.1';
37
+ ts.version = '{{version}}';
36
38
 
37
39
  ts.parsers = [];
38
40
  ts.widgets = [];
@@ -104,7 +106,7 @@
104
106
  cssIconAsc : '', // class name added to the icon when the column has an ascending sort
105
107
  cssIconDesc : '', // class name added to the icon when the column has a descending sort
106
108
  cssInfoBlock : 'tablesorter-infoOnly', // don't sort tbody with this class name (only one class name allowed here!)
107
- cssAllowClicks : 'tablesorter-allowClicks', // class name added to table header which allows clicks to bubble up
109
+ cssNoSort : 'tablesorter-noSort', // class name added to element inside header; clicking on it won't cause a sort
108
110
  cssIgnoreRow : 'tablesorter-ignoreRow', // header row to ignore; cells within this row will not be added to c.$headers
109
111
 
110
112
  // *** selectors
@@ -136,7 +138,6 @@
136
138
  headerRow : 'tablesorter-headerRow',
137
139
  headerIn : 'tablesorter-header-inner',
138
140
  icon : 'tablesorter-icon',
139
- info : 'tablesorter-infoOnly',
140
141
  processing : 'tablesorter-processing',
141
142
  sortAsc : 'tablesorter-headerAsc',
142
143
  sortDesc : 'tablesorter-headerDesc',
@@ -180,37 +181,39 @@
180
181
  return true;
181
182
  }
182
183
 
183
- function getElementText(table, node, cellIndex) {
184
+ ts.getElementText = function(c, node, cellIndex) {
184
185
  if (!node) { return ''; }
185
186
  var te,
186
- $node = $(node),
187
- c = table.config,
188
- t = c.textExtraction || '';
187
+ t = c.textExtraction || '',
188
+ // node could be a jquery object
189
+ // http://jsperf.com/jquery-vs-instanceof-jquery/2
190
+ $node = node.jquery ? node : $(node);
189
191
  if (typeof(t) === 'string') {
190
192
  // check data-attribute first when set to 'basic'; don't use node.innerText - it's really slow!
191
- return $.trim( (t === 'basic' ? $node.attr(c.textAttribute) || node.textContent : node.textContent ) || $node.text() || '' );
193
+ return $.trim( ( t === 'basic' ? $node.attr(c.textAttribute) || node.textContent : node.textContent ) || $node.text() || '' );
192
194
  } else {
193
195
  if (typeof(t) === 'function') {
194
- return $.trim( t(node, table, cellIndex) );
195
- } else if (typeof (te = ts.getColumnData( table, t, cellIndex )) === 'function') {
196
- return $.trim( te(node, table, cellIndex) );
196
+ return $.trim( t($node[0], c.table, cellIndex) );
197
+ } else if (typeof (te = ts.getColumnData( c.table, t, cellIndex )) === 'function') {
198
+ return $.trim( te($node[0], c.table, cellIndex) );
197
199
  }
198
200
  }
199
201
  // fallback
200
- return $.trim( node.textContent || $node.text() || '' );
201
- }
202
+ return $.trim( $node[0].textContent || $node.text() || '' );
203
+ };
202
204
 
203
205
  function detectParserForColumn(table, rows, rowIndex, cellIndex) {
204
206
  var cur, $node,
205
- i = ts.parsers.length,
206
- node = false,
207
- nodeValue = '',
208
- keepLooking = true;
207
+ c = table.config,
208
+ i = ts.parsers.length,
209
+ node = false,
210
+ nodeValue = '',
211
+ keepLooking = true;
209
212
  while (nodeValue === '' && keepLooking) {
210
213
  rowIndex++;
211
214
  if (rows[rowIndex]) {
212
215
  node = rows[rowIndex].cells[cellIndex];
213
- nodeValue = getElementText(table, node, cellIndex);
216
+ nodeValue = ts.getElementText(c, node, cellIndex);
214
217
  $node = $(node);
215
218
  if (table.config.debug) {
216
219
  log('Checking if value was empty on row ' + rowIndex + ', column: ' + cellIndex + ': "' + nodeValue + '"');
@@ -293,10 +296,10 @@
293
296
 
294
297
  /* utils */
295
298
  function buildCache(table) {
296
- var cc, t, tx, v, i, j, k, $row, rows, cols, cacheTime,
299
+ var cc, t, tx, v, i, j, k, $row, cols, cacheTime,
297
300
  totalRows, rowData, colMax,
298
301
  c = table.config,
299
- $tb = c.$table.children('tbody'),
302
+ $tb = c.$tbodies,
300
303
  extractors = c.extractors,
301
304
  parsers = c.parsers;
302
305
  c.cache = {};
@@ -319,68 +322,65 @@
319
322
  // colMax: # // added at the end
320
323
  };
321
324
 
322
- // ignore tbodies with class name from c.cssInfoBlock
323
- if (!$tb.eq(k).hasClass(c.cssInfoBlock)) {
324
- totalRows = ($tb[k] && $tb[k].rows.length) || 0;
325
- for (i = 0; i < totalRows; ++i) {
326
- rowData = {
327
- // order: original row order #
328
- // $row : jQuery Object[]
329
- child: [], // child row text (filter widget)
330
- raw: [] // original row text
331
- };
332
- /** Add the table data to main data array */
333
- $row = $($tb[k].rows[i]);
334
- rows = [ new Array(c.columns) ];
335
- cols = [];
336
- // if this is a child row, add it to the last row's children and continue to the next row
337
- // ignore child row class, if it is the first row
338
- if ($row.hasClass(c.cssChildRow) && i !== 0) {
339
- t = cc.normalized.length - 1;
340
- cc.normalized[t][c.columns].$row = cc.normalized[t][c.columns].$row.add($row);
341
- // add 'hasChild' class name to parent row
342
- if (!$row.prev().hasClass(c.cssChildRow)) {
343
- $row.prev().addClass(ts.css.cssHasChild);
325
+ totalRows = ($tb[k] && $tb[k].rows.length) || 0;
326
+ for (i = 0; i < totalRows; ++i) {
327
+ rowData = {
328
+ // order: original row order #
329
+ // $row : jQuery Object[]
330
+ child: [], // child row text (filter widget)
331
+ raw: [] // original row text
332
+ };
333
+ /** Add the table data to main data array */
334
+ $row = $($tb[k].rows[i]);
335
+ cols = [];
336
+ // if this is a child row, add it to the last row's children and continue to the next row
337
+ // ignore child row class, if it is the first row
338
+ if ($row.hasClass(c.cssChildRow) && i !== 0) {
339
+ t = cc.normalized.length - 1;
340
+ cc.normalized[t][c.columns].$row = cc.normalized[t][c.columns].$row.add($row);
341
+ // add 'hasChild' class name to parent row
342
+ if (!$row.prev().hasClass(c.cssChildRow)) {
343
+ $row.prev().addClass(ts.css.cssHasChild);
344
+ }
345
+ // save child row content (un-parsed!)
346
+ rowData.child[t] = $.trim( $row[0].textContent || $row.text() || '' );
347
+ // go to the next for loop
348
+ continue;
349
+ }
350
+ rowData.$row = $row;
351
+ rowData.order = i; // add original row position to rowCache
352
+ for (j = 0; j < c.columns; ++j) {
353
+ if (typeof parsers[j] === 'undefined') {
354
+ if (c.debug) {
355
+ log('No parser found for cell:', $row[0].cells[j], 'does it have a header?');
344
356
  }
345
- // save child row content (un-parsed!)
346
- rowData.child[t] = $.trim( $row[0].textContent || $row.text() || '' );
347
- // go to the next for loop
348
357
  continue;
349
358
  }
350
- rowData.$row = $row;
351
- rowData.order = i; // add original row position to rowCache
352
- for (j = 0; j < c.columns; ++j) {
353
- if (typeof parsers[j] === 'undefined') {
354
- if (c.debug) {
355
- log('No parser found for cell:', $row[0].cells[j], 'does it have a header?');
356
- }
357
- continue;
358
- }
359
- t = getElementText(table, $row[0].cells[j], j);
360
- rowData.raw.push(t); // save original row text
361
- // do extract before parsing if there is one
362
- if (typeof extractors[j].id === 'undefined') {
363
- tx = t;
364
- } else {
365
- tx = extractors[j].format(t, table, $row[0].cells[j], j);
366
- }
367
- // allow parsing if the string is empty, previously parsing would change it to zero,
368
- // in case the parser needs to extract data from the table cell attributes
369
- v = parsers[j].id === 'no-parser' ? '' : parsers[j].format(tx, table, $row[0].cells[j], j);
370
- cols.push( c.ignoreCase && typeof v === 'string' ? v.toLowerCase() : v );
371
- if ((parsers[j].type || '').toLowerCase() === 'numeric') {
372
- // determine column max value (ignore sign)
373
- colMax[j] = Math.max(Math.abs(v) || 0, colMax[j] || 0);
374
- }
359
+ t = ts.getElementText(c, $row[0].cells[j], j);
360
+ rowData.raw.push(t); // save original row text
361
+ // do extract before parsing if there is one
362
+ if (typeof extractors[j].id === 'undefined') {
363
+ tx = t;
364
+ } else {
365
+ tx = extractors[j].format(t, table, $row[0].cells[j], j);
366
+ }
367
+ // allow parsing if the string is empty, previously parsing would change it to zero,
368
+ // in case the parser needs to extract data from the table cell attributes
369
+ v = parsers[j].id === 'no-parser' ? '' : parsers[j].format(tx, table, $row[0].cells[j], j);
370
+ cols.push( c.ignoreCase && typeof v === 'string' ? v.toLowerCase() : v );
371
+ if ((parsers[j].type || '').toLowerCase() === 'numeric') {
372
+ // determine column max value (ignore sign)
373
+ colMax[j] = Math.max(Math.abs(v) || 0, colMax[j] || 0);
375
374
  }
376
- // ensure rowData is always in the same location (after the last column)
377
- cols[c.columns] = rowData;
378
- cc.normalized.push(cols);
379
375
  }
380
- cc.colMax = colMax;
381
- // total up rows, not including child rows
382
- c.totalRows += cc.normalized.length;
376
+ // ensure rowData is always in the same location (after the last column)
377
+ cols[c.columns] = rowData;
378
+ cc.normalized.push(cols);
383
379
  }
380
+ cc.colMax = colMax;
381
+ // total up rows, not including child rows
382
+ c.totalRows += cc.normalized.length;
383
+
384
384
  }
385
385
  if (c.showProcessing) {
386
386
  ts.isProcessing(table); // remove processing icon
@@ -394,7 +394,7 @@
394
394
  function appendToTable(table, init) {
395
395
  var c = table.config,
396
396
  wo = c.widgetOptions,
397
- b = table.tBodies,
397
+ $tbodies = c.$tbodies,
398
398
  rows = [],
399
399
  cc = c.cache,
400
400
  n, totalRows, $bk, $tb,
@@ -408,9 +408,9 @@
408
408
  if (c.debug) {
409
409
  appendTime = new Date();
410
410
  }
411
- for (k = 0; k < b.length; k++) {
412
- $bk = $(b[k]);
413
- if ($bk.length && !$bk.hasClass(c.cssInfoBlock)) {
411
+ for (k = 0; k < $tbodies.length; k++) {
412
+ $bk = $tbodies.eq(k);
413
+ if ($bk.length) {
414
414
  // get tbody
415
415
  $tb = ts.processTbody(table, $bk, true);
416
416
  n = cc[k].normalized;
@@ -752,23 +752,23 @@
752
752
  // sort multiple columns
753
753
  function multisort(table) { /*jshint loopfunc:true */
754
754
  var i, k, num, col, sortTime, colMax,
755
- cache, order, sort, x, y,
755
+ rows, order, sort, x, y,
756
756
  dir = 0,
757
757
  c = table.config,
758
758
  cts = c.textSorter || '',
759
759
  sortList = c.sortList,
760
760
  l = sortList.length,
761
- bl = table.tBodies.length;
761
+ bl = c.$tbodies.length;
762
762
  if (c.serverSideSorting || isEmptyObject(c.cache)) { // empty table - fixes #206/#346
763
763
  return;
764
764
  }
765
765
  if (c.debug) { sortTime = new Date(); }
766
766
  for (k = 0; k < bl; k++) {
767
767
  colMax = c.cache[k].colMax;
768
- cache = c.cache[k].normalized;
768
+ rows = c.cache[k].normalized;
769
769
 
770
- cache.sort(function(a, b) {
771
- // cache is undefined here in IE, so don't use it!
770
+ rows.sort(function(a, b) {
771
+ // rows is undefined here in IE, so don't use it!
772
772
  for (i = 0; i < l; i++) {
773
773
  col = sortList[i][0];
774
774
  order = sortList[i][1];
@@ -851,12 +851,12 @@
851
851
  function bindMethods(table){
852
852
  var c = table.config,
853
853
  $table = c.$table,
854
- events = 'sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache ' +
855
- 'updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave '.split(' ')
854
+ events = ('sortReset update updateRows updateCell updateAll addRows updateComplete sorton appendCache ' +
855
+ 'updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave ').split(' ')
856
856
  .join(c.namespace + ' ');
857
857
  // apply easy methods that trigger bound events
858
858
  $table
859
- .unbind( $.trim(events) )
859
+ .unbind( events.replace(/\s+/g, ' ') )
860
860
  .bind('sortReset' + c.namespace, function(e, callback){
861
861
  e.stopPropagation();
862
862
  c.sortList = [];
@@ -889,7 +889,7 @@
889
889
  $table.find(c.selectorRemove).remove();
890
890
  // get position from the dom
891
891
  var v, t, row, icell,
892
- $tb = $table.find('tbody'),
892
+ $tb = c.$tbodies,
893
893
  $cell = $(cell),
894
894
  // update cache - format: function(s, table, cell, cellIndex)
895
895
  // no closest in jQuery v1.2.6 - tbdy = $tb.index( $(cell).closest('tbody') ),$row = $(cell).closest('tr');
@@ -902,9 +902,9 @@
902
902
  icell = $cell.index();
903
903
  c.cache[tbdy].normalized[row][c.columns].$row = $row;
904
904
  if (typeof c.extractors[icell].id === 'undefined') {
905
- t = getElementText(table, cell, icell);
905
+ t = ts.getElementText(c, cell, icell);
906
906
  } else {
907
- t = c.extractors[icell].format( getElementText(table, cell, icell), table, cell, icell );
907
+ t = c.extractors[icell].format( ts.getElementText(c, cell, icell), table, cell, icell );
908
908
  }
909
909
  v = c.parsers[icell].id === 'no-parser' ? '' :
910
910
  c.parsers[icell].format( t, table, cell, icell );
@@ -938,7 +938,7 @@
938
938
  $row = $($row).attr('role', 'row'); // make sure we're using a jQuery object
939
939
  var i, j, l, t, v, rowData, cells,
940
940
  rows = $row.filter('tr').length,
941
- tbdy = $table.find('tbody').index( $row.parents('tbody').filter(':first') );
941
+ tbdy = c.$tbodies.index( $row.parents('tbody').filter(':first') );
942
942
  // fixes adding rows to an empty table - see issue #179
943
943
  if (!(c.parsers && c.parsers.length)) {
944
944
  buildParserCache(table);
@@ -955,9 +955,9 @@
955
955
  // add each cell
956
956
  for (j = 0; j < l; j++) {
957
957
  if (typeof c.extractors[j].id === 'undefined') {
958
- t = getElementText(table, $row[i].cells[j], j);
958
+ t = ts.getElementText(c, $row[i].cells[j], j);
959
959
  } else {
960
- t = c.extractors[j].format( getElementText(table, $row[i].cells[j], j), table, $row[i].cells[j], j );
960
+ t = c.extractors[j].format( ts.getElementText(c, $row[i].cells[j], j), table, $row[i].cells[j], j );
961
961
  }
962
962
  v = c.parsers[j].id === 'no-parser' ? '' :
963
963
  c.parsers[j].format( t, table, $row[i].cells[j], j );
@@ -1198,7 +1198,7 @@
1198
1198
  colgroup = $('<colgroup class="' + ts.css.colgroup + '">');
1199
1199
  overallWidth = c.$table.width();
1200
1200
  // only add col for visible columns - fixes #371
1201
- $(table.tBodies).not('.' + c.cssInfoBlock).find('tr:first').children(':visible').each(function() {
1201
+ c.$tbodies.find('tr:first').children(':visible').each(function() {
1202
1202
  percent = parseInt( ( $(this).width() / overallWidth ) * 1000, 10 ) / 10 + '%';
1203
1203
  colgroup.append( $('<col>').css('width', percent) );
1204
1204
  });
@@ -1330,9 +1330,11 @@
1330
1330
  $headers
1331
1331
  // http://stackoverflow.com/questions/5312849/jquery-find-self;
1332
1332
  .find(c.selectorSort).add( $headers.filter(c.selectorSort) )
1333
- .unbind( $.trim('mousedown mouseup sort keyup '.split(' ').join(c.namespace + ' ')) )
1334
- .bind( $.trim('mousedown mouseup sort keyup '.split(' ').join(c.namespace + ' ')), function(e, external) {
1335
- var cell, type = e.type;
1333
+ .unbind( ('mousedown mouseup sort keyup '.split(' ').join(c.namespace + ' ')).replace(/\s+/g, ' ') )
1334
+ .bind( 'mousedown mouseup sort keyup '.split(' ').join(c.namespace + ' '), function(e, external) {
1335
+ var cell,
1336
+ $target = $(e.target),
1337
+ type = e.type;
1336
1338
  // only recognize left clicks or enter
1337
1339
  if ( ((e.which || e.button) !== 1 && !/sort|keyup/.test(type)) || (type === 'keyup' && e.which !== 13) ) {
1338
1340
  return;
@@ -1342,9 +1344,16 @@
1342
1344
  // set timer on mousedown
1343
1345
  if (type === 'mousedown') {
1344
1346
  downTime = new Date().getTime();
1345
- return /(input|select|button|textarea)/i.test(e.target.tagName) ||
1346
- // allow clicks to contents of selected cells
1347
- $(e.target).closest('td,th').hasClass(c.cssAllowClicks) ? '' : !c.cancelSelection;
1347
+ return;
1348
+ }
1349
+ cell = $.fn.closest ? $target.closest('td,th') : $target.parents('td,th').filter(':first');
1350
+ // prevent sort being triggered on form elements
1351
+ if ( /(input|select|button|textarea)/i.test(e.target.tagName) ||
1352
+ // nosort class name, or elements within a nosort container
1353
+ $target.hasClass(c.cssNoSort) || $target.parents('.' + c.cssNoSort).length > 0 ||
1354
+ // elements within a button
1355
+ $target.parents('button').length > 0 ) {
1356
+ return !c.cancelSelection;
1348
1357
  }
1349
1358
  if (c.delayInit && isEmptyObject(c.cache)) { buildCache(table); }
1350
1359
  // jQuery v1.2.6 doesn't have closest()
@@ -1406,13 +1415,13 @@
1406
1415
  .join(c.namespace + ' ');
1407
1416
  $t
1408
1417
  .removeData('tablesorter')
1409
- .unbind( $.trim(events) );
1418
+ .unbind( events.replace(/\s+/g, ' ') );
1410
1419
  c.$headers.add($f)
1411
1420
  .removeClass( [ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone].join(' ') )
1412
1421
  .removeAttr('data-column')
1413
1422
  .removeAttr('aria-label')
1414
1423
  .attr('aria-disabled', 'true');
1415
- $r.find(c.selectorSort).unbind( $.trim('mousedown mouseup keypress '.split(' ').join(c.namespace + ' ')) );
1424
+ $r.find(c.selectorSort).unbind( ('mousedown mouseup keypress '.split(' ').join(c.namespace + ' ')).replace(/\s+/g, ' ') );
1416
1425
  ts.restoreHeaders(table);
1417
1426
  $t.toggleClass(ts.css.table + ' ' + c.tableClass + ' tablesorter-' + c.theme, removeClasses === false);
1418
1427
  // clear flag in case the plugin is initialized again