From ad8fb89ec3ae21b59a474e57d72115f7d65b260c Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Sun, 15 May 2016 20:34:45 -0400 Subject: [PATCH] Visibility type: fixed now properly tears down on destroy #3548 --- RELEASE-NOTES.md | 1 + src/definitions/behaviors/visibility.js | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 058a357a6..8783a545d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -91,6 +91,7 @@ - **Step** - Fix incorrect bottom margin on `top attached steps` - **Statistic** - statistic receives incorrect size when using `tiny` `large` etc inside a statistic group #3116 - **Table** - `striped selectable` table would not correctly show hover color on striped rows +- **Visibility** - Using `type: fixed` will now correctly remove all special classes and placeholder content on `destroy` #3548 **Enhancements** - **Project** - NPM depenendencies have all been updated to latest stable releases diff --git a/src/definitions/behaviors/visibility.js b/src/definitions/behaviors/visibility.js index 9f897ff66..4762c4c7e 100644 --- a/src/definitions/behaviors/visibility.js +++ b/src/definitions/behaviors/visibility.js @@ -125,6 +125,10 @@ $.fn.visibility = function(parameters) { $context .off('scrollchange' + eventNamespace, module.event.scrollchange) ; + if(settings.type == 'fixed') { + module.resetFixed(); + module.remove.placeholder(); + } $module .off(eventNamespace) .removeData(moduleNamespace) @@ -389,8 +393,7 @@ $.fn.visibility = function(parameters) { refresh: function() { module.debug('Refreshing constants (width/height)'); if(settings.type == 'fixed') { - module.remove.fixed(); - module.remove.occurred(); + module.resetFixed(); } module.reset(); module.save.position(); @@ -400,6 +403,11 @@ $.fn.visibility = function(parameters) { settings.onRefresh.call(element); }, + resetFixed: function () { + module.remove.fixed(); + module.remove.occurred(); + }, + reset: function() { module.verbose('Reseting all cached values'); if( $.isPlainObject(module.cache) ) { @@ -766,6 +774,12 @@ $.fn.visibility = function(parameters) { ; settings.onUnfixed.call(element); }, + placeholder: function() { + module.debug('Removing placeholder content'); + if($placeholder) { + $placeholder.remove(); + } + }, occurred: function(callback) { if(callback) { var