all files / popper/utils/ isTransformed.js

100% Statements 5/5
83.33% Branches 5/6
100% Functions 1/1
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                      235× 106×   129×   127×    
import getStyleComputedProperty from './getStyleComputedProperty';
import getParentNode from './getParentNode';
 
/**
 * Check if the given element has transforms applied to itself or a parent
 * @method
 * @memberof Popper.Utils
 * @param  {Element} element
 * @return {Boolean} answer to "isTransformed?"
 */
export default function isTransformed(element) {
  if (element.nodeName === 'BODY') {
      return false;
  }
  if (getStyleComputedProperty(element, 'transform') !== 'none') {
      return true;
  }
  return getParentNode(element) ? isTransformed(getParentNode(element)) : element;
}