Fix parent position check before applying relative style if none of the valid positions are used

This commit is contained in:
Kevin MacMartin 2015-07-02 13:05:28 -04:00
parent ae68564e88
commit fc9f124c7c

View file

@ -5,11 +5,9 @@ function ContainElement(options) {
var elementHeight = options.height || element.offsetHeight; var elementHeight = options.height || element.offsetHeight;
// Apply required attributes to the element and its parents if they aren't already set // Apply required attributes to the element and its parents if they aren't already set
if (element.style.position != 'absolute') element.style.position = 'absolute';
element.style.position = 'absolute'; element.parentElement.style.overflow = 'hidden';
if (element.parentElement.style.overflow != 'hidden') if (['relative', 'absolute', 'fixed'].indexOf(window.getComputedStyle(element.parentElement,null).getPropertyValue('position')) === -1)
element.parentElement.style.overflow = 'hidden';
if (['relative', 'absolute', 'fixed'].indexOf(element.parentElement.style.position) === -1)
element.parentElement.style.position = 'relative'; element.parentElement.style.position = 'relative';
function updateContain() { function updateContain() {