From 4108c45a220e8f1a0eeaf9cf516cbc202883d8a0 Mon Sep 17 00:00:00 2001 From: ithielnor Date: Mon, 9 Mar 2015 12:52:14 -0400 Subject: [PATCH 1/2] Fix table's within tables bug --- jquery.floatThead.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jquery.floatThead.js b/jquery.floatThead.js index e2da820..81de08a 100644 --- a/jquery.floatThead.js +++ b/jquery.floatThead.js @@ -201,8 +201,8 @@ throw new Error('jQuery.floatThead must be run on a table element. ex: $("table").floatThead();'); } canObserveMutations = opts.autoReflow && canObserveMutations; //option defaults to false! - var $header = $table.find('thead:first'); - var $tbody = $table.find('tbody:first'); + var $header = $table.children('thead:first'); + var $tbody = $table.children('tbody:first'); if($header.length == 0){ throw new Error('jQuery.floatThead must be run on a table that contains a element'); } @@ -234,7 +234,7 @@ var absoluteToFixedOnScroll = ieVersion <= 9 && !locked && useAbsolutePositioning; //on IE using absolute positioning doesn't look good with window scrolling, so we change position to fixed on scroll, and then change it back to absolute when done. var $floatTable = $(""); var $floatColGroup = $(""); - var $tableColGroup = $table.find('colgroup:first'); + var $tableColGroup = $table.children('colgroup:first'); var existingColGroup = true; if($tableColGroup.length == 0){ $tableColGroup = $(""); @@ -323,7 +323,7 @@ function setHeaderHeight(){ var headerHeight = 0; - $header.find("tr:visible").each(function(){ + $header.children("tr:visible").each(function(){ headerHeight += $(this).outerHeight(true); }); $sizerRow.outerHeight(headerHeight); @@ -420,8 +420,8 @@ } $table.css(layoutFixed); $floatTable.css(layoutFixed); + $header.after($newHeader); $floatTable.append($header); //append because colgroup must go first in chrome - $tbody.before($newHeader); setHeaderHeight(); } } @@ -808,9 +808,9 @@ }, getRowGroups: function(){ if(headerFloated){ - return $floatContainer.find("thead").add($table.find("tbody,tfoot")); + return $floatContainer.children("thead").add($table.children("tbody,tfoot")); } else { - return $table.find("thead,tbody,tfoot"); + return $table.children("thead,tbody,tfoot"); } } }); From 62eb3860553e6f02a447d0c4e10f54bbfa166bb8 Mon Sep 17 00:00:00 2001 From: ithielnor Date: Tue, 10 Mar 2015 13:44:26 -0400 Subject: [PATCH 2/2] Revert $newheader insertion change --- jquery.floatThead.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.floatThead.js b/jquery.floatThead.js index 81de08a..bf40aa2 100644 --- a/jquery.floatThead.js +++ b/jquery.floatThead.js @@ -420,8 +420,8 @@ } $table.css(layoutFixed); $floatTable.css(layoutFixed); - $header.after($newHeader); $floatTable.append($header); //append because colgroup must go first in chrome + $tbody.before($newHeader); setHeaderHeight(); } }