{"name":"@asamuzakjp/dom-selector","version":"2.0.2-a.2","author":{"name":"asamuzaK"},"license":"MIT","_id":"@asamuzakjp/dom-selector@2.0.2-a.2","maintainers":[{"name":"asamuzakjp","email":"info@asamuzak.jp"}],"homepage":"https://github.com/asamuzaK/domSelector#readme","bugs":{"url":"https://github.com/asamuzaK/domSelector/issues"},"dist":{"shasum":"9b33a95aa44e7da390e91518def0e8ff21395ce6","tarball":"http://registry-npm.ywwl.com/@asamuzakjp/dom-selector/download/@asamuzakjp/dom-selector-2.0.2-a.2.tgz","fileCount":24,"integrity":"sha512-CeWfsHn9ebIC81DcbjVlOIuDhR8m/fc1AwC9MnKWKZ4KuUJGjHD5hAOTdrZb3B4KTYoK1jY+AF4gmryWzb4ZdA==","signatures":[{"sig":"MEYCIQDQav4CRlUDzBpnquicZDLV/AhfaByopB7cX5CzmplYSQIhAIQUyCiZjRikWYS8SvD9YV4tjRTUfwf5G8Zo1ecqTXRU","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":344268,"size":69272,"noattachment":false,"key":"/@asamuzakjp/dom-selector/-/@asamuzakjp/dom-selector-2.0.2-a.2.tgz"},"type":"module","types":"types/index.d.ts","readme":"# DOM Selector\n\n[![build](https://github.com/asamuzaK/domSelector/actions/workflows/node.js.yml/badge.svg)](https://github.com/asamuzaK/domSelector/actions/workflows/node.js.yml)\n[![CodeQL](https://github.com/asamuzaK/domSelector/actions/workflows/codeql.yml/badge.svg)](https://github.com/asamuzaK/domSelector/actions/workflows/codeql.yml)\n[![npm (scoped)](https://img.shields.io/npm/v/@asamuzakjp/dom-selector)](https://www.npmjs.com/package/@asamuzakjp/dom-selector)\n\nA CSS selector engine.\nUsed in jsdom since [jsdom v23.2.0](https://github.com/jsdom/jsdom/releases/tag/23.2.0).\n\n## Install\n\n```console\nnpm i @asamuzakjp/dom-selector\n```\n\n## Usage\n\n```javascript\nimport {\n  matches, closest, querySelector, querySelectorAll\n} from '@asamuzakjp/dom-selector';\n```\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n### matches(selector, node, opt)\n\nmatches - same functionality as [Element.matches()][64]\n\n#### Parameters\n\n- `selector` **[string][59]** CSS selector\n- `node` **[object][60]** Element node\n- `opt` **[object][60]?** options\n  - `opt.warn` **[boolean][61]?** console warn e.g. unsupported pseudo-class\n\nReturns **[boolean][61]** `true` if matched, `false` otherwise\n\n\n### closest(selector, node, opt)\n\nclosest - same functionality as [Element.closest()][65]\n\n#### Parameters\n\n- `selector` **[string][59]** CSS selector\n- `node` **[object][60]** Element node\n- `opt` **[object][60]?** options\n  - `opt.warn` **[boolean][61]?** console warn e.g. unsupported pseudo-class\n\nReturns **[object][60]?** matched node\n\n\n### querySelector(selector, node, opt)\n\nquerySelector - same functionality as [Document.querySelector()][66], [DocumentFragment.querySelector()][67], [Element.querySelector()][68]\n\n#### Parameters\n\n- `selector` **[string][59]** CSS selector\n- `node` **[object][60]** Document, DocumentFragment or Element node\n- `opt` **[object][60]?** options\n  - `opt.warn` **[boolean][61]?** console warn e.g. unsupported pseudo-class\n\nReturns **[object][60]?** matched node\n\n\n### querySelectorAll(selector, node, opt)\n\nquerySelectorAll - same functionality as [Document.querySelectorAll()][69], [DocumentFragment.querySelectorAll()][70], [Element.querySelectorAll()][71]  \n**NOTE**: returns Array, not NodeList\n\n#### Parameters\n\n- `selector` **[string][59]** CSS selector\n- `node` **[object][60]** Document, DocumentFragment or Element node\n- `opt` **[object][60]?** options\n  - `opt.warn` **[boolean][61]?** console warn e.g. unsupported pseudo-class\n\nReturns **[Array][62]&lt;([object][60] \\| [undefined][63])>** array of matched nodes\n\n\n## Supported CSS selectors\n\n|Pattern|Supported|Note|\n|:--------|:-------:|:--------|\n|\\*|✓| |\n|ns\\|E|✓| |\n|\\*\\|E|✓| |\n|\\|E|✓| |\n|E|✓| |\n|E:not(s1, s2, …)|✓| |\n|E:is(s1, s2, …)|✓| |\n|E:where(s1, s2, …)|✓| |\n|E:has(rs1, rs2, …)|✓| |\n|E.warning|✓| |\n|E#myid|✓| |\n|E\\[foo\\]|✓| |\n|E\\[foo=\"bar\"\\]|✓| |\n|E\\[foo=\"bar\"&nbsp;i\\]|✓| |\n|E\\[foo=\"bar\"&nbsp;s\\]|✓| |\n|E\\[foo~=\"bar\"\\]|✓| |\n|E\\[foo^=\"bar\"\\]|✓| |\n|E\\[foo$=\"bar\"\\]|✓| |\n|E\\[foo*=\"bar\"\\]|✓| |\n|E\\[foo\\|=\"en\"\\]|✓| |\n|E:defined|Unsupported| |\n|E:dir(ltr)|✓| |\n|E:lang(en)|Partially supported|Comma-separated list of language codes, e.g. `:lang(en, fr)`, is not yet supported.|\n|E:any&#8209;link|✓| |\n|E:link|✓| |\n|E:visited|✓|Returns `false` or `null` to prevent fingerprinting.|\n|E:local&#8209;link|✓| |\n|E:target|✓| |\n|E:target&#8209;within|✓| |\n|E:scope|✓| |\n|E:current|Unsupported| |\n|E:current(s)|Unsupported| |\n|E:past|Unsupported| |\n|E:future|Unsupported| |\n|E:active|Unsupported| |\n|E:hover|Unsupported| |\n|E:focus|✓| |\n|E:focus&#8209;within|✓| |\n|E:focus&#8209;visible|Unsupported| |\n|E:enabled<br>E:disabled|✓| |\n|E:read&#8209;write<br>E:read&#8209;only|✓| |\n|E:placeholder&#8209;shown|✓| |\n|E:default|✓| |\n|E:checked|✓| |\n|E:indeterminate|✓| |\n|E:valid<br>E:invalid|✓| |\n|E:required<br>E:optional|✓| |\n|E:blank|Unsupported| |\n|E:user&#8209;invalid|Unsupported| |\n|E:root|✓| |\n|E:empty|✓| |\n|E:nth&#8209;child(n&nbsp;[of&nbsp;S]?)|✓| |\n|E:nth&#8209;last&#8209;child(n&nbsp;[of&nbsp;S]?)|✓| |\n|E:first&#8209;child|✓| |\n|E:last&#8209;child|✓| |\n|E:only&#8209;child|✓| |\n|E:nth&#8209;of&#8209;type(n)|✓| |\n|E:nth&#8209;last&#8209;of&#8209;type(n)|✓| |\n|E:first&#8209;of&#8209;type|✓| |\n|E:last&#8209;of&#8209;type|✓| |\n|E:only&#8209;of&#8209;type|✓| |\n|E&nbsp;F|✓| |\n|E > F|✓| |\n|E + F|✓| |\n|E ~ F|✓| |\n|F \\|\\| E|Unsupported| |\n|E:nth&#8209;col(n)|Unsupported| |\n|E:nth&#8209;last&#8209;col(n)|Unsupported| |\n|:host|✓| |\n|:host(s)|✓| |\n|:host&#8209;context(s)|✓| |\n\n\n<!--\n### Performance\n\nTODO: rewrite benchmark table\n-->\n\n\n## Acknowledgments\n\nThe following resources have been of great help in the development of the DOM Selector.\n\n- [CSSTree](https://github.com/csstree/csstree)\n- [selery](https://github.com/danburzo/selery)\n- [jsdom](https://github.com/jsdom/jsdom)\n\n\n---\nCopyright (c) 2023 [asamuzaK (Kazz)](https://github.com/asamuzaK/)\n\n\n[1]: #matches\n[2]: #parameters\n[3]: #closest\n[4]: #parameters-1\n[5]: #queryselector\n[6]: #parameters-2\n[7]: #queryselectorall\n[8]: #parameters-3\n[59]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String\n[60]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object\n[61]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean\n[62]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array\n[63]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined\n[64]: https://developer.mozilla.org/docs/Web/API/Element/matches\n[65]: https://developer.mozilla.org/docs/Web/API/Element/closest\n[66]: https://developer.mozilla.org/docs/Web/API/Document/querySelector\n[67]: https://developer.mozilla.org/docs/Web/API/DocumentFragment/querySelector\n[68]: https://developer.mozilla.org/docs/Web/API/Element/querySelector\n[69]: https://developer.mozilla.org/docs/Web/API/Document/querySelectorAll\n[70]: https://developer.mozilla.org/docs/Web/API/DocumentFragment/querySelectorAll\n[71]: https://developer.mozilla.org/docs/Web/API/Element/querySelectorAll\n","exports":{"import":"./src/index.js","require":"./dist/cjs/index.js"},"gitHead":"d7896e6d6a35bd6f986d1dbe49109a0c70643240","scripts":{"tsc":"npx tsc","lint":"eslint --fix .","test":"c8 --reporter=text mocha --exit test/**/*.test.js","bench":"node benchmark/bench.js","build":"npm run tsc && npm run lint && npm test && npm run compat","compat":"esbuild --format=cjs --platform=node --outdir=dist/cjs/ --minify --sourcemap src/**/*.js","test-wpt":"node test/wpt/wpt-runner.js","update-wpt":"git submodule update --init --recursive --remote","bench-sizzle":"node benchmark/bench-sizzle.js"},"_npmUser":{"name":"asamuzakjp","email":"info@asamuzak.jp"},"repository":{"url":"git+https://github.com/asamuzaK/domSelector.git","type":"git"},"_npmVersion":"10.2.1","description":"A CSS selector engine.","directories":{},"_nodeVersion":"20.10.0","dependencies":{"bidi-js":"^1.0.3","css-tree":"^2.3.1","is-potential-custom-element-name":"^1.0.1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"c8":"^9.0.0","chai":"^5.0.0","jsdom":"23.1.0","mocha":"^10.2.0","sinon":"^17.0.1","eslint":"^8.56.0","esbuild":"^0.19.11","linkedom":"^0.16.6","benchmark":"^2.1.4","commander":"^11.1.0","happy-dom":"^12.10.3","typescript":"^5.3.3","wpt-runner":"^5.0.0","@types/css-tree":"^2.3.4","eslint-plugin-jsdoc":"^48.0.2","eslint-plugin-import":"^2.29.1","eslint-plugin-regexp":"^2.1.2","eslint-plugin-unicorn":"^50.0.1","eslint-config-standard":"^17.1.0"},"_npmOperationalInternal":{"tmp":"tmp/dom-selector_2.0.2-a.2_1704876919272_0.2398235371228692","host":"s3://npm-registry-packages"},"publish_time":1704876919456,"_cnpm_publish_time":1704876919456,"dist-tags":{"beta":"0.2.2","dev":"6.5.0-a.16","latest":"10.0.5","next":"8.0.0-a.2"}}