export function getScrollParent(el) {
  while (true) {
    el = el.parentNode;
    if (!el) break;
    if (el.nodeType === 9) return el; // document

    const {
      overflow,
      overflowX,
      overflowY
    } = getComputedStyle(el);
    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) break;
  }

  return el;
}
export function getScrollParents(el) {
  let sccrollableNodes = [];
  let cursor = el;

  while (true) {
    cursor = getScrollParent(cursor);
    if (!cursor) break;
    sccrollableNodes.push(cursor);
  }

  return sccrollableNodes;
}