function isVisible(el) {
  var loopable = true,
    visible =
      getComputedStyle(el).display != 'none' &&
      getComputedStyle(el).visibility != 'hidden';

  while (loopable && visible) {
    el = el.parentNode;

    if (el && el != document.body) {
      visible =
        getComputedStyle(el).display != 'none' &&
        getComputedStyle(el).visibility != 'hidden';
    } else {
      loopable = false;
    }
  }

  return visible;
}

module.exports = {
  isVisible,
};
