var _elements = null;
var _handlers = null;
var _hoverId = null;
- var _suspended = false;
var _timeoutEnter = null;
var _timeoutLeave = null;
}
});
+ _popover.addEventListener('transitionend', this._clearContent.bind(this));
+
window.addEventListener('beforeunload', (function() {
_suspended = true;
this._hide(true);
loadCallback: options.loadCallback
});
- this._init(options.identifier)
+ this._init(options.identifier);
},
/**
element.addEventListener('mouseleave', _callbackMouseLeave);
if (element.nodeName === 'A' && element.getAttribute('href')) {
- element.addEventListener('click', _callbackClick)
+ element.addEventListener('click', _callbackClick);
}
var cacheId = identifier + "-" + objectId;
}
var disableAnimation = (_activeId !== null && _activeId !== _hoverId);
- if (disableAnimation) {
- var activeElData = _cache.get(_elements.get(_activeId).element.getAttribute('data-cache-id'));
- while (_popoverContent.childNodes.length) {
- activeElData.content.appendChild(_popoverContent.childNodes[0]);
- }
- }
-
if (_popover.classList.contains('active')) {
this._hide(disableAnimation);
}
// force reflow
_popover.offsetHeight;
+
+ this._clearContent();
+ }
+ },
+
+ /**
+ * Clears popover content by moving it back into the cache.
+ */
+ _clearContent: function() {
+ if (_activeId && _popoverContent.childElementCount && !_popover.classList.contains('active')) {
+ var activeElData = _cache.get(_elements.get(_activeId).element.getAttribute('data-cache-id'));
+ while (_popoverContent.childNodes.length) {
+ activeElData.content.appendChild(_popoverContent.childNodes[0]);
+ }
+
+ _popoverContent.style.removeProperty('height');
}
},
_popoverContent.style.removeProperty('height');
var height = _popoverContent.offsetHeight;
- console.debug(_baseHeight);
- console.debug(height);
_popoverContent.style.setProperty('height', _baseHeight + 'px');
// force reflow
var dialog = document.createElement('div');
dialog.classList.add('dialogContainer');
dialog.setAttribute('aria-hidden', 'true');
- dialog.setAttribute('role', 'dialog')
+ dialog.setAttribute('role', 'dialog');
dialog.setAttribute('data-id', id);
if (options.disposeOnClose) {