From 0e05035b7104baa80614eefab90b6d90996ca3dc Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 27 Oct 2009 04:12:39 +0000 Subject: =?UTF-8?q?#610204=20by=20effulgentsia,=20G=C3=A1bor=20Hojtsy,=20s?= =?UTF-8?q?un,=20Damien=20Tournoud=20and=20ksenzee:=20API=20changes=20to?= =?UTF-8?q?=20support=20overlays:=20lays=20ground=20work=20for=20implement?= =?UTF-8?q?ation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- misc/drupal.js | 11 +++++++++++ misc/tableheader.js | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'misc') diff --git a/misc/drupal.js b/misc/drupal.js index ea688a499..87a5972c6 100644 --- a/misc/drupal.js +++ b/misc/drupal.js @@ -344,4 +344,15 @@ Drupal.theme.prototype = { } }; +/** + * Return whether the given variable is an object. + * + * The HEAD version of jQuery (http://code.jquery.com/jquery-nightly.js) + * includes an isObject() function, so when that gets released and incorporated + * into Drupal, this can be removed. + */ +$.extend({isObject: function(value) { + return (value !== null && typeof value === 'object'); +}}); + })(jQuery); diff --git a/misc/tableheader.js b/misc/tableheader.js index 813e4c7ca..0192d30b2 100644 --- a/misc/tableheader.js +++ b/misc/tableheader.js @@ -18,8 +18,9 @@ Drupal.behaviors.tableHeader = { var headers = []; $('table.sticky-enabled thead', context).once('tableheader', function () { - // Clone thead so it inherits original jQuery properties. - var headerClone = $(this).clone(true).insertBefore(this.parentNode).wrap('').parent().css({ + // Clone the table header so it inherits original jQuery properties. Hide + // the table to avoid a flash of the header clone upon page load. + var headerClone = $(this).clone(true).hide().insertBefore(this.parentNode).wrap('').parent().css({ position: 'fixed', top: '0px' }); @@ -32,6 +33,9 @@ Drupal.behaviors.tableHeader = { headerClone.table = table; // Finish initializing header positioning. tracker(headerClone); + // We hid the header to avoid it showing up erroneously on page load; + // we need to unhide it now so that it will show up when expected. + $(headerClone).children('thead').show(); $(table).addClass('sticky-table'); }); -- cgit v1.2.3