Fixing infinity loop issue

This commit is contained in:
Bruno Alves de Faria 2017-11-08 08:38:36 -02:00
parent cea3a77b52
commit 0eea7f9373

View File

@ -6,15 +6,15 @@ $.fn.tempShow = function(callback) {
let current = this; let current = this;
// Temporarily show all parent invisible elements until body // Temporarily show all parent invisible elements until body
while (this.is(':hidden') && current !== document.body) { while (this.is(':hidden')) {
const $element = this.parentsUntil(':visible').last(); const $element = $(current);
if (!$element.length) { if (!$element.length || $element.is(':visible')) {
break; break;
} }
$element.addClass('visible'); $element.addClass('visible');
current = $element[0];
elementsToHide.push(current); elementsToHide.push(current);
current = $element[0].parentElement;
} }
if (typeof callback === 'function') { if (typeof callback === 'function') {