{"_id":"get-dom-document","_rev":"4078461","name":"get-dom-document","description":"Get a [DOM document](https://developer.mozilla.org/en-US/docs/Web/API/Document) in both Node.js and the browser environment.","dist-tags":{"latest":"0.1.3"},"maintainers":[{"name":"ocavue","email":""}],"time":{"modified":"2025-10-13T19:32:24.000Z","created":"2022-09-22T10:40:39.135Z","0.1.3":"2022-10-17T09:00:14.023Z","0.1.2":"2022-10-14T10:20:33.551Z","0.1.1":"2022-09-23T05:45:51.149Z","0.1.0":"2022-09-22T10:40:39.135Z"},"users":{},"author":{"name":"ocavue","email":"ocavue@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/ocavue/get-dom-document.git"},"versions":{"0.1.3":{"name":"get-dom-document","version":"0.1.3","type":"commonjs","main":"./lib/get-dom-document.node.js","browser":"./lib/get-dom-document.browser.js","types":"./lib/get-dom-document.d.ts","exports":{"types":"./lib/get-dom-document.d.ts","node":{"import":"./lib/get-dom-document.node.mjs","require":"./lib/get-dom-document.node.js"},"browser":{"import":"./lib/get-dom-document.browser.mjs","require":"./lib/get-dom-document.browser.js"},"default":"./lib/get-dom-document.node.js"},"description":"Get a [DOM document](https://developer.mozilla.org/en-US/docs/Web/API/Document) in both Node.js and the browser environment.","author":{"name":"ocavue","email":"ocavue@gmail.com"},"license":"MIT","funding":"https://github.com/sponsors/ocavue","homepage":"https://github.com/ocavue/get-dom-document","repository":{"type":"git","url":"git+https://github.com/ocavue/get-dom-document.git"},"keywords":[],"sideEffects":false,"scripts":{"release":"bumpp && npm publish"},"peerDependencies":{"jsdom":"*"},"peerDependenciesMeta":{"jsdom":{"optional":true}},"devDependencies":{"bumpp":"^8.2.1"},"gitHead":"e3f6613b5f1899e6edd4ec577233eb1f3c36bc51","bugs":{"url":"https://github.com/ocavue/get-dom-document/issues"},"_id":"get-dom-document@0.1.3","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"shasum":"d0188090e43d38dd146c467ac6e3e1f2ace7af52","size":2015,"noattachment":false,"key":"/get-dom-document/-/get-dom-document-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/get-dom-document/download/get-dom-document-0.1.3.tgz"},"_npmUser":{"name":"ocavue","email":"ocavue@gmail.com"},"directories":{},"maintainers":[{"name":"ocavue","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-dom-document_0.1.3_1665997213866_0.4144683622807055"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-17T09:07:44.956Z","publish_time":1665997214023,"_cnpm_publish_time":1665997214023},"0.1.2":{"name":"get-dom-document","version":"0.1.2","type":"commonjs","main":"./lib/get-dom-document.node.js","module":"./lib/get-dom-document.node.mjs","browser":"./lib/get-dom-document.browser.js","types":"./lib/get-dom-document.d.ts","exports":{"types":"./lib/get-dom-document.d.ts","node":{"import":"./lib/get-dom-document.node.mjs","require":"./lib/get-dom-document.node.js"},"browser":{"import":"./lib/get-dom-document.browser.mjs","require":"./lib/get-dom-document.browser.js"},"default":"./lib/get-dom-document.node.js"},"description":"Get a [DOM document](https://developer.mozilla.org/en-US/docs/Web/API/Document) in both Node.js and the browser environment.","author":{"name":"ocavue","email":"ocavue@gmail.com"},"license":"MIT","funding":"https://github.com/sponsors/ocavue","homepage":"https://github.com/ocavue/get-dom-document","repository":{"type":"git","url":"git+https://github.com/ocavue/get-dom-document.git"},"keywords":[],"sideEffects":false,"peerDependencies":{"jsdom":"*"},"peerDependenciesMeta":{"jsdom":{"optional":true}},"devDependencies":{"bumpp":"^8.2.1"},"scripts":{"release":"bumpp && npm publish"},"bugs":{"url":"https://github.com/ocavue/get-dom-document/issues"},"_id":"get-dom-document@0.1.2","_integrity":"sha512-vh+334mlpztbnwcmBkuUgszzurptR7z3ZquoW2Xq1hapGDyfzXWktPksyFQocjSN+NyFx9g1M8NaB8ncdBgATg==","_resolved":"/private/var/folders/00/y54gq_b567l2cd0qtqqqlysm0000gn/T/2906313ba707971d6e6c0ecd3896551b/get-dom-document-0.1.2.tgz","_from":"file:get-dom-document-0.1.2.tgz","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"shasum":"1e6f3e2a7fe26d8655ba97cc5b06a8e1297336e4","size":2042,"noattachment":false,"key":"/get-dom-document/-/get-dom-document-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/get-dom-document/download/get-dom-document-0.1.2.tgz"},"_npmUser":{"name":"ocavue","email":"ocavue@gmail.com"},"directories":{},"maintainers":[{"name":"ocavue","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-dom-document_0.1.2_1665742833417_0.8850973872059125"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-14T11:01:13.706Z","publish_time":1665742833551,"_cnpm_publish_time":1665742833551},"0.1.1":{"name":"get-dom-document","version":"0.1.1","type":"commonjs","main":"./lib/get-dom-document.node.js","module":"./lib/get-dom-document.node.mjs","browser":"./lib/get-dom-document.browser.js","types":"./lib/get-dom-document.d.ts","exports":{"types":"./lib/get-dom-document.d.ts","node":{"import":"./lib/get-dom-document.node.mjs","require":"./lib/get-dom-document.node.js"},"browser":{"import":"./lib/get-dom-document.browser.mjs","require":"./lib/get-dom-document.browser.js"},"default":"./lib/get-dom-document.node.js"},"description":"Get a [DOM document](https://developer.mozilla.org/en-US/docs/Web/API/Document) in both Node.js and the browser environment.","author":{"name":"ocavue","email":"ocavue@gmail.com"},"license":"MIT","funding":"https://github.com/sponsors/ocavue","homepage":"https://github.com/ocavue/get-dom-document","repository":{"type":"git","url":"git+https://github.com/ocavue/get-dom-document.git"},"keywords":[],"sideEffects":false,"scripts":{"release":"bumpp && npm publish"},"peerDependencies":{"jsdom":"*"},"peerDependenciesMeta":{"jsdom":{"optional":true}},"devDependencies":{"bumpp":"^8.2.1"},"gitHead":"121679c6ffea0a76adcf575f52b8ec6d042c1dab","bugs":{"url":"https://github.com/ocavue/get-dom-document/issues"},"_id":"get-dom-document@0.1.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"shasum":"a50975471c93a897295276299af0a9bba8542496","size":1932,"noattachment":false,"key":"/get-dom-document/-/get-dom-document-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/get-dom-document/download/get-dom-document-0.1.1.tgz"},"_npmUser":{"name":"ocavue","email":"ocavue@gmail.com"},"directories":{},"maintainers":[{"name":"ocavue","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-dom-document_0.1.1_1663911950962_0.6134509934082888"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-23T05:48:09.244Z","publish_time":1663911951149,"_cnpm_publish_time":1663911951149},"0.1.0":{"name":"get-dom-document","version":"0.1.0","type":"commonjs","main":"./lib/get-dom-document.node.js","module":"./lib/get-dom-document.node.mjs","browser":"./lib/get-dom-document.browser.js","types":"./lib/get-dom-document.d.ts","exports":{"types":"./lib/get-dom-document.d.ts","node":{"import":"./lib/get-dom-document.node.mjs","require":"./lib/get-dom-document.node.js"},"browser":{"import":"./lib/get-dom-document.browser.mjs","require":"./lib/get-dom-document.browser.js"},"default":"./lib/get-dom-document.node.js"},"description":"Get a [DOM document](https://developer.mozilla.org/en-US/docs/Web/API/Document) in both Node.js and the browser environment.","author":{"name":"ocavue","email":"ocavue@gmail.com"},"license":"MIT","funding":"https://github.com/sponsors/ocavue","homepage":"https://github.com/ocavue/get-dom-document","repository":{"type":"git","url":"git+https://github.com/ocavue/get-dom-document.git"},"keywords":[],"sideEffects":false,"scripts":{"release":"bumpp && npm publish"},"peerDependencies":{"jsdom":"*"},"peerDependenciesMeta":{"jsdom":{"optional":true}},"devDependencies":{"bumpp":"^8.2.1"},"gitHead":"216a8d78220714ec1e3d728f1fec34758f8002ce","bugs":{"url":"https://github.com/ocavue/get-dom-document/issues"},"_id":"get-dom-document@0.1.0","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"shasum":"cd4aecc6f858240495545da951088f32f3060070","size":1931,"noattachment":false,"key":"/get-dom-document/-/get-dom-document-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/get-dom-document/download/get-dom-document-0.1.0.tgz"},"_npmUser":{"name":"ocavue","email":"ocavue@gmail.com"},"directories":{},"maintainers":[{"name":"ocavue","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/get-dom-document_0.1.0_1663843238944_0.5510424823355724"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-22T11:29:14.105Z","publish_time":1663843239135,"_cnpm_publish_time":1663843239135}},"readme":"# get-dom-document\n\nGet a [DOM document](https://developer.mozilla.org/en-US/docs/Web/API/Document) in both Node.js and the browser environment.\n\n`getDomDocument` will firstly try to get the DOM document from the global `document` object. If it is not available, it will try to create a new DOM document using [`jsdom`](https://github.com/jsdom/jsdom) in Node.js environment. If `jsdom` is not available or it's not running in Node.js environment, it will return `null`.\n\nThis package use the `browser` field in `package.json` and [conditional exports](https://nodejs.org/docs/latest-v16.x/api/packages.html#conditional-exports) to provide different implementations for Node.js and the browser environment.\n\n## Install\n\n```\nnpm install get-dom-document\n```\n\n## Usage\n\nCommonJS:\n\n```js\nconst { getDomDocument } = require(\"get-dom-document\");\n\nconst document = getDomDocument();\n```\n\nES module:\n\n```js\nimport { getDomDocument } from \"get-dom-document\";\n\nconst document = getDomDocument();\n```\n","_attachments":{},"homepage":"https://github.com/ocavue/get-dom-document","bugs":{"url":"https://github.com/ocavue/get-dom-document/issues"},"license":"MIT"}