Skip to content
Snippets Groups Projects
Commit 061433ad authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#208197 by dvessel: back to cloning the table header only in tableheader.js...

#208197 by dvessel: back to cloning the table header only in tableheader.js (fixes radio button issues and Safari 2 crashing)
parent e78d7eb2
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -10,23 +10,12 @@ Drupal.behaviors.tableHeader = function (context) { ...@@ -10,23 +10,12 @@ Drupal.behaviors.tableHeader = function (context) {
var headers = []; var headers = [];
$('table thead:not(.tableHeader-processed)', context).each(function () { $('table thead:not(.tableHeader-processed)', context).each(function () {
// Clone table and remove unwanted elements so it inherits original properties. // Clone thead so it inherits original jQuery properties.
var headerClone = $(this.parentNode).clone(true).insertBefore(this.parentNode).addClass('sticky-header').css({ var headerClone = $(this).clone(true).insertBefore(this.parentNode).wrap('<table class="sticky-header"></table>').parent().css({
position: 'fixed', position: 'fixed',
visibility: 'hidden',
top: '0px' top: '0px'
}); });
// Sets an id for cloned table header.
var headerID = headerClone.attr('id');
if (headerID != '') {
headerClone.attr('id', headerID + '-header');
}
// Everything except thead must be removed. See theme_table().
$('tbody', headerClone).remove();
$('caption', headerClone).remove();
var headerClone = $(headerClone)[0]; var headerClone = $(headerClone)[0];
headers.push(headerClone); headers.push(headerClone);
...@@ -50,6 +39,7 @@ Drupal.behaviors.tableHeader = function (context) { ...@@ -50,6 +39,7 @@ Drupal.behaviors.tableHeader = function (context) {
e.vPosition = $(e.table).offset().top; e.vPosition = $(e.table).offset().top;
e.hPosition = $(e.table).offset().left; e.hPosition = $(e.table).offset().left;
e.vLength = $(e.table).height(); e.vLength = $(e.table).height();
e.resizeWidths = true;
} }
// Track horizontal positioning relative to the viewport and set visibility. // Track horizontal positioning relative to the viewport and set visibility.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment