Skip to content

Commit

Permalink
removed enableAria option, it is now always enabled without breakin…
Browse files Browse the repository at this point in the history
…g layouts

`.floatThead('destroy')` now returns a function which will reinit the plugin with the same options which were originally used to create it
  • Loading branch information
mkoryak committed Aug 22, 2016
1 parent b7ad14f commit 48a43b2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 28 deletions.
15 changes: 7 additions & 8 deletions dist/jquery.floatThead-slim.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @preserve jQuery.floatThead 1.4.3dev - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
// @preserve jQuery.floatThead 1.4.3 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
// @license MIT

/* @author Misha Koryak
Expand Down Expand Up @@ -39,7 +39,6 @@
floatWrapperClass: 'floatThead-wrapper',
floatContainerClass: 'floatThead-container',
copyTableClass: true, //copy 'class' attribute from table into the floated table so that the styles match.
enableAria: false, //will copy header text from the floated header back into the table for screen readers. Might cause the css styling to be off. beware!
autoReflow: false, //(undocumented) - use MutationObserver api to reflow automatically when internal table DOM changes
debug: false, //print possible issues (that don't prevent script loading) to console, if console exists.
support: { //should we bind events that expect these frameworks to be present and/or check for them?
Expand Down Expand Up @@ -367,7 +366,7 @@
var $floatContainer = $('<div>').css('overflow', 'hidden').attr('aria-hidden', 'true');
var floatTableHidden = false; //this happens when the table is hidden and we do magic when making it visible
var $newHeader = $("<thead/>");
var $sizerRow = $('<tr class="size-row"/>');
var $sizerRow = $('<tr class="size-row" aria-hidden="true"/>');
var $sizerCells = $([]);
var $tableCells = $([]); //used for sizing - either $sizerCells or $tableColGroup cols. $tableColGroup cols are only created in chrome for borderCollapse:collapse because of a chrome bug.
var $headerCells = $([]);
Expand Down Expand Up @@ -508,11 +507,8 @@
lastColumnCount = count;
var cells = [], cols = [], psuedo = [], content;
for(var x = 0; x < count; x++){
if (opts.enableAria && (content = $headerColumns.eq(x).text()) ) {
cells.push('<th scope="col" class="floatThead-col">' + content + '</th>');
} else {
cells.push('<th class="floatThead-col"/>');
}
content = $headerColumns.eq(x).text();
cells.push('<th class="floatThead-col" aria-label="'+content+'"/>');
cols.push('<col/>');
psuedo.push(
$('<fthtd>').css({
Expand Down Expand Up @@ -1034,6 +1030,9 @@
&& window.matchMedia("print").removeListener(printEvent);
beforePrint = afterPrint = function(){};
}
return function reinit(){
return $table.floatThead(opts);
}
},
reflow: function(){
reflowEvent();
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.floatThead-slim.min.js

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions dist/jquery.floatThead.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @preserve jQuery.floatThead 1.4.3dev - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
// @preserve jQuery.floatThead 1.4.3 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
// @license MIT

/* @author Misha Koryak
Expand Down Expand Up @@ -39,7 +39,6 @@
floatWrapperClass: 'floatThead-wrapper',
floatContainerClass: 'floatThead-container',
copyTableClass: true, //copy 'class' attribute from table into the floated table so that the styles match.
enableAria: false, //will copy header text from the floated header back into the table for screen readers. Might cause the css styling to be off. beware!
autoReflow: false, //(undocumented) - use MutationObserver api to reflow automatically when internal table DOM changes
debug: false, //print possible issues (that don't prevent script loading) to console, if console exists.
support: { //should we bind events that expect these frameworks to be present and/or check for them?
Expand Down Expand Up @@ -367,7 +366,7 @@
var $floatContainer = $('<div>').css('overflow', 'hidden').attr('aria-hidden', 'true');
var floatTableHidden = false; //this happens when the table is hidden and we do magic when making it visible
var $newHeader = $("<thead/>");
var $sizerRow = $('<tr class="size-row"/>');
var $sizerRow = $('<tr class="size-row" aria-hidden="true"/>');
var $sizerCells = $([]);
var $tableCells = $([]); //used for sizing - either $sizerCells or $tableColGroup cols. $tableColGroup cols are only created in chrome for borderCollapse:collapse because of a chrome bug.
var $headerCells = $([]);
Expand Down Expand Up @@ -508,11 +507,8 @@
lastColumnCount = count;
var cells = [], cols = [], psuedo = [], content;
for(var x = 0; x < count; x++){
if (opts.enableAria && (content = $headerColumns.eq(x).text()) ) {
cells.push('<th scope="col" class="floatThead-col">' + content + '</th>');
} else {
cells.push('<th class="floatThead-col"/>');
}
content = $headerColumns.eq(x).text();
cells.push('<th class="floatThead-col" aria-label="'+content+'"/>');
cols.push('<col/>');
psuedo.push(
$('<fthtd>').css({
Expand Down Expand Up @@ -1034,6 +1030,9 @@
&& window.matchMedia("print").removeListener(printEvent);
beforePrint = afterPrint = function(){};
}
return function reinit(){
return $table.floatThead(opts);
}
},
reflow: function(){
reflowEvent();
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.floatThead.min.js

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions jquery.floatThead.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @preserve jQuery.floatThead 1.4.3dev - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
// @preserve jQuery.floatThead 1.4.3 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2016 Misha Koryak
// @license MIT

/* @author Misha Koryak
Expand Down Expand Up @@ -39,7 +39,6 @@
floatWrapperClass: 'floatThead-wrapper',
floatContainerClass: 'floatThead-container',
copyTableClass: true, //copy 'class' attribute from table into the floated table so that the styles match.
enableAria: false, //will copy header text from the floated header back into the table for screen readers. Might cause the css styling to be off. beware!
autoReflow: false, //(undocumented) - use MutationObserver api to reflow automatically when internal table DOM changes
debug: false, //print possible issues (that don't prevent script loading) to console, if console exists.
support: { //should we bind events that expect these frameworks to be present and/or check for them?
Expand Down Expand Up @@ -367,7 +366,7 @@
var $floatContainer = $('<div>').css('overflow', 'hidden').attr('aria-hidden', 'true');
var floatTableHidden = false; //this happens when the table is hidden and we do magic when making it visible
var $newHeader = $("<thead/>");
var $sizerRow = $('<tr class="size-row"/>');
var $sizerRow = $('<tr class="size-row" aria-hidden="true"/>');
var $sizerCells = $([]);
var $tableCells = $([]); //used for sizing - either $sizerCells or $tableColGroup cols. $tableColGroup cols are only created in chrome for borderCollapse:collapse because of a chrome bug.
var $headerCells = $([]);
Expand Down Expand Up @@ -508,11 +507,8 @@
lastColumnCount = count;
var cells = [], cols = [], psuedo = [], content;
for(var x = 0; x < count; x++){
if (opts.enableAria && (content = $headerColumns.eq(x).text()) ) {
cells.push('<th scope="col" class="floatThead-col">' + content + '</th>');
} else {
cells.push('<th class="floatThead-col"/>');
}
content = $headerColumns.eq(x).text();
cells.push('<th class="floatThead-col" aria-label="'+content+'"/>');
cols.push('<col/>');
psuedo.push(
$('<fthtd>').css({
Expand Down Expand Up @@ -1034,6 +1030,9 @@
&& window.matchMedia("print").removeListener(printEvent);
beforePrint = afterPrint = function(){};
}
return function reinit(){
return $table.floatThead(opts);
}
},
reflow: function(){
reflowEvent();
Expand Down

0 comments on commit 48a43b2

Please sign in to comment.