datatable: simplify, no need for extra variable - jscancer - Javascript crap (relatively small)
(HTM) git clone git://git.codemadness.org/jscancer
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ed82eea91230781e2e5ba243b86ca94621d7222c
(DIR) parent f9891fdfc1014d220da0169d87d0c2b0b545fa3c
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 4 Apr 2019 18:44:55 +0200
datatable: simplify, no need for extra variable
Diffstat:
M datatable/datatable.js | 5 ++---
M datatable/datatable_lite.js | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/datatable/datatable.js b/datatable/datatable.js
@@ -8,8 +8,7 @@ function datatable_sort_default(x, y) {
}
function datatable_init(el) {
- var thead = el.tHead,
- tbody = el.tBodies[0];
+ var thead = el.tHead;
var ths = thead.children[0].children,
cols = [];
for (var i = 0; i < ths.length; i++)
@@ -23,7 +22,7 @@ function datatable_init(el) {
table: el,
thead: thead,
ths: ths,
- tbody: tbody,
+ tbody: el.tBodies[0],
cols: cols,
sort: [], // sort options: [colidx, order (ASC = 0, DESC = 1)].
lazyscroll: ["1", "true"].indexOf(el.getAttribute("data-lazyscroll") || "") != -1,
(DIR) diff --git a/datatable/datatable_lite.js b/datatable/datatable_lite.js
@@ -8,8 +8,7 @@ function datatable_sort_default(x, y) {
}
function datatable_init(el) {
- var thead = el.tHead,
- tbody = el.tBodies[0];
+ var thead = el.tHead;
var ths = thead.children[0].children,
cols = [];
for (var i = 0; i < ths.length; i++)
@@ -22,7 +21,7 @@ function datatable_init(el) {
table: el,
thead: thead,
ths: ths,
- tbody: tbody,
+ tbody: el.tBodies[0],
cols: cols,
sort: [] // sort options: [colidx, order (ASC = 0, DESC = 1)].
};