{"_id":"stacking-order","_rev":"3810913","name":"stacking-order","description":"Determine which of two elements is in front of the other","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"rich_harris","email":""}],"time":{"modified":"2025-06-05T11:13:03.000Z","created":"2016-01-30T20:43:13.625Z","2.0.0":"2022-11-21T01:05:26.622Z","1.0.1":"2022-11-20T23:28:05.540Z","1.0.0":"2016-01-30T20:43:13.625Z"},"users":{},"author":{"name":"Rich Harris"},"repository":{"type":"git","url":"git+https://github.com/Rich-Harris/stacking-order.git"},"versions":{"2.0.0":{"name":"stacking-order","description":"Determine which of two elements is in front of the other","version":"2.0.0","author":{"name":"Rich Harris"},"type":"module","main":"index.js","repository":{"type":"git","url":"git+https://github.com/Rich-Harris/stacking-order.git"},"license":"MIT","devDependencies":{"kleur":"^4.1.5","playwright":"^1.28.0","typescript":"^4.9.3"},"exports":{".":{"types":"./types/index.d.ts","import":"./index.js","default":"./index.js"}},"scripts":{"prepublishOnly":"npm test && tsc","test":"node test/test.js"},"gitHead":"4ac30371ddad979460f250a744f782692e091fc5","bugs":{"url":"https://github.com/Rich-Harris/stacking-order/issues"},"homepage":"https://github.com/Rich-Harris/stacking-order#readme","_id":"stacking-order@2.0.0","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"shasum":"90e78ca977527f03762591ce1ecbc7f6abf24ed0","size":2143,"noattachment":false,"key":"/stacking-order/-/stacking-order-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stacking-order/download/stacking-order-2.0.0.tgz"},"_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"directories":{},"maintainers":[{"name":"rich_harris","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stacking-order_2.0.0_1668992726483_0.7333919713544053"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-21T01:05:30.407Z","publish_time":1668992726622,"_cnpm_publish_time":1668992726622},"1.0.1":{"name":"stacking-order","description":"Determine which of two elements is in front of the other","version":"1.0.1","author":{"name":"Rich Harris"},"main":"dist/stacking-order.umd.js","jsnext:main":"dist/stacking-order.es6.js","repository":{"type":"git","url":"git+https://gitlab.com/Rich-Harris/stacking-order.git"},"license":"MIT","devDependencies":{"babel-cli":"^6.4.5","babel-preset-es2015":"^6.3.13","chalk":"^1.1.1","eslint":"^1.10.3","rollup":"^0.25.1","rollup-plugin-buble":"^0.4.0"},"scripts":{"build":"npm run build:umd && npm run build:es6","build:umd":"rollup -c -f umd -o dist/stacking-order.umd.js","build:es6":"rollup -c -f es6 -o dist/stacking-order.es6.js","prepublish":"npm run lint && rm -rf dist && npm test && npm run build:es6","pretest":"npm run build:umd","test":"node test/test.js","lint":"eslint src"},"gitHead":"eb9ad371ba75827e6f4e0f0ee423df6af69695d9","bugs":{"url":"https://gitlab.com/Rich-Harris/stacking-order/issues"},"homepage":"https://gitlab.com/Rich-Harris/stacking-order#readme","_id":"stacking-order@1.0.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"shasum":"dd362c9390e53f38f1e3cb172cd4374a011f4d1f","size":4592,"noattachment":false,"key":"/stacking-order/-/stacking-order-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/stacking-order/download/stacking-order-1.0.1.tgz"},"_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"directories":{},"maintainers":[{"name":"rich_harris","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stacking-order_1.0.1_1668986885364_0.46545073887559907"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-20T23:28:08.056Z","publish_time":1668986885540,"_cnpm_publish_time":1668986885540},"1.0.0":{"name":"stacking-order","description":"Determine which of two elements is in front of the other","version":"1.0.0","author":{"name":"Rich Harris"},"main":"dist/stacking-order.umd.js","jsnext:main":"dist/stacking-order.es6.js","repository":{"type":"git","url":"git+https://gitlab.com/Rich-Harris/stacking-order.git"},"license":"MIT","devDependencies":{"babel-cli":"^6.4.5","babel-preset-es2015":"^6.3.13","babel-preset-es2015-rollup":"^1.1.1","chalk":"^1.1.1","eslint":"^1.10.3","nightmare":"^2.1.4","rollup":"^0.25.1","rollup-plugin-babel":"^2.3.9"},"files":["src","dist","README.md"],"scripts":{"build":"npm run build:umd && npm run build:es6","build:umd":"rollup -c -f umd -o dist/stacking-order.umd.js","build:es6":"rollup -c -f es6 -o dist/stacking-order.es6.js","prepublish":"npm run lint && rm -rf dist && npm test && npm run build:es6","pretest":"npm run build:umd","test":"babel-node test/test.js","lint":"eslint src"},"gitHead":"bf0f506b91f97fc6ad3056da5c7f2a5911cce554","bugs":{"url":"https://gitlab.com/Rich-Harris/stacking-order/issues"},"homepage":"https://gitlab.com/Rich-Harris/stacking-order#README","_id":"stacking-order@1.0.0","_shasum":"1c7facf276d824c545663ccc17a5cbfda48417d9","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.1","_npmUser":{"name":"rich_harris","email":"richard.a.harris@gmail.com"},"dist":{"shasum":"1c7facf276d824c545663ccc17a5cbfda48417d9","size":5271,"noattachment":false,"key":"/stacking-order/-/stacking-order-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/stacking-order/download/stacking-order-1.0.0.tgz"},"maintainers":[{"name":"rich_harris","email":""}],"directories":{},"publish_time":1454186593625,"_hasShrinkwrap":false,"_cnpm_publish_time":1454186593625,"_cnpmcore_publish_time":"2021-12-17T07:25:49.999Z"}},"readme":"# stacking-order\n\nDetermine which of two nodes appears in front of the other.\n\n## Why?\n\nThe [stacking order rules](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context) 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 `opacity`, `transform`, `mix-blend-mode` and various others that you probably hadn't considered.\n\nThe 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).\n\n## Installation\n\n```bash\nnpm install --save stacking-order\n```\n\n...or grab a copy from [npmcdn.com/stacking-order](https://npmcdn.com/stacking-order).\n\n## Usage\n\n```js\nimport { compare } from 'stacking-order';\n\nconst a = document.querySelector('.a');\nconst b = document.querySelector('.b');\n\nconst order = compare(a, b);\n// -> `1` if a is in front of b, `-1` otherwise\n```\n\n## Bugs\n\nIt's entirely possible that the algorithm used here doesn't exactly match the spec. If you find a bug, please [raise an issue](https://github.com/Rich-Harris/stacking-order/issues) after reading [CONTRIBUTING.md](CONTRIBUTING.md). Thanks!\n\n## License\n\nMIT\n\n---\n\nmade by [@rich_harris](https://twitter.com/rich_harris)\n","_attachments":{},"homepage":"https://github.com/Rich-Harris/stacking-order#readme","bugs":{"url":"https://github.com/Rich-Harris/stacking-order/issues"},"license":"MIT"}