compare-stacking-order
v0.1.2
Published
Compare stacking order of two nodes.
Readme
compare-stacking-order
Compare stacking order of two nodes.
Usage
import { compareStackingOrder } from 'compare-stacking-order';
const order = compareStackingOrder(a, b);
// `1` if a is in front of b, `-1` otherwise.Why
I’ve found it remarkably challenging to determine the rendering order of two nodes with pure CSS. You must account for Stacking Context, Stacking Floating Elements Rules, and certain inheritance relationships of rendering layers that are almost undocumented – which led to the creation of this package.
Check out the Demo on StackBlitz to see various edge cases encountered during the package’s development – contributions are welcome ;)
