UNPKG

@juggle/resize-observer

Version:

Polyfills the ResizeObserver API and supports box size options from the latest spec

15 lines (14 loc) 339 B
import { isHidden } from '../utils/element'; var calculateDepthForNode = function (node) { if (isHidden(node)) { return Infinity; } var depth = 0; var parent = node.parentNode; while (parent) { depth += 1; parent = parent.parentNode; } return depth; }; export { calculateDepthForNode };