Determine which of two nodes appears in front of the other.
The stacking order rules are fairly complex. Determining whether node A will render in front of node B involves much more than comparing the
z-index of the two nodes – you have to consider their parents, and which of them create new stacking contexts, which in turn depends on CSS properties like
mix-blend-mode and various others that you probably hadn't considered.
The tie-breaker, if that doesn't yield a conclusive answer, is the position in the document (with later nodes rendering in front of earlier nodes).
npm install --save stacking-order
...or grab a copy from npmcdn.com/stacking-order.
var stackingOrder = ;var a = document;var b = document;var order = stackingOrder;// -> `1` if a is in front of b, `-1` otherwise
made by @rich_harris