|
18 | 18 | this.options = options; |
19 | 19 | this.$tableWrapper = null; //defined later in wrapTable |
20 | 20 | this.$tableScrollWrapper = $(element); //defined later in wrapTable |
21 | | - this.$table = $(element).find("table"); |
| 21 | + this.$table = $(element).find("table:first"); |
22 | 22 |
|
23 | 23 | if (this.$table.length !== 1) { |
24 | 24 | throw new Error( |
|
41 | 41 | this.$stickyTableHeader = null; //defined farther down |
42 | 42 |
|
43 | 43 | //good to have - for easy access |
44 | | - this.$thead = this.$table.find("thead"); |
| 44 | + this.$thead = this.$table.children("thead"); |
45 | 45 | this.$hdrCells = this.$thead.find("tr").first().find("th"); |
46 | | - this.$bodyRows = this.$table.find("tbody, tfoot").find("tr"); |
| 46 | + this.$bodyRows = this.$table.children("tbody, tfoot").children("tr"); |
47 | 47 |
|
48 | 48 | //toolbar and buttons |
49 | 49 | this.$btnToolbar = null; //defined farther down |
|
276 | 276 | if ($("html").hasClass("lt-ie9")) { |
277 | 277 | displayProp = "inline"; |
278 | 278 | } |
279 | | - |
280 | | - $(this.$table).find("th, td").css("display", displayProp); |
| 279 | + var cellE = "> thead > tr > th, > thead > tr > td,> tfoot > tr > th, > tfoot > tr > td,> tbody > tr > th, > tbody > tr > td"; |
| 280 | + $(this.$table).find(cellE).css("display", displayProp); |
281 | 281 | if (this.$tableClone) { |
282 | | - $(this.$tableClone).find("th, td").css("display", displayProp); |
| 282 | + $(this.$tableClone).find(cellE).css("display", displayProp); |
283 | 283 | } |
284 | 284 | }; |
285 | 285 |
|
|
614 | 614 | var idStart = 0; |
615 | 615 |
|
616 | 616 | // for each cell |
617 | | - $row.find("th, td").each(function () { |
| 617 | + $row.children("th, td").each(function () { |
618 | 618 | var $cell = $(this); |
619 | 619 | var columnsAttr = ""; |
620 | 620 |
|
|
705 | 705 |
|
706 | 706 | // Run this after the content in tbody has changed |
707 | 707 | ResponsiveTable.prototype.update = function () { |
708 | | - this.$bodyRows = this.$table.find("tbody, tfoot").find("tr"); |
| 708 | + this.$bodyRows = this.$table.children("tbody, tfoot").children("tr"); |
709 | 709 | this.setupBodyRows(); |
710 | 710 |
|
711 | 711 | // Remove old tbody clone from Tableclone |
712 | | - this.$tableClone.find("tbody, tfoot").remove(); |
| 712 | + this.$tableClone.children("tbody, tfoot").remove(); |
713 | 713 |
|
714 | 714 | // Make new clone of tbody |
715 | | - var $tbodyClone = this.$table.find("tbody, tfoot").clone(); |
| 715 | + var $tbodyClone = this.$table.children("tbody, tfoot").clone(); |
716 | 716 |
|
717 | 717 | //replace ids |
718 | 718 | $tbodyClone.find("[id]").each(function () { |
|
0 commit comments