{"_id":"tx-parser","_rev":"29332058","name":"tx-parser","description":"This is the exact same JSDOM package but with a slight edit to allow custom attribute names. All credits goe to JSDOM developers","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"hassanzohdy","email":"hassanzohdy@gmail.com"}],"time":{"modified":"2019-01-30T01:01:33.000Z","created":"2019-01-30T01:01:11.771Z","1.0.0":"2019-01-30T01:01:11.771Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/jsdom/jsdom.git"},"versions":{"1.0.0":{"dependencies":{"abab":"^2.0.0","acorn":"^6.0.4","acorn-globals":"^4.3.0","array-equal":"^1.0.0","cssom":"^0.3.4","cssstyle":"^1.1.1","data-urls":"^1.1.0","domexception":"^1.0.1","escodegen":"^1.11.0","html-encoding-sniffer":"^1.0.2","nwsapi":"^2.0.9","parse5":"5.1.0","pn":"^1.1.0","request":"^2.88.0","request-promise-native":"^1.0.5","saxes":"^3.1.4","symbol-tree":"^3.2.2","tough-cookie":"^2.5.0","w3c-hr-time":"^1.0.1","w3c-xmlserializer":"^1.0.1","webidl-conversions":"^4.0.2","whatwg-encoding":"^1.0.5","whatwg-mimetype":"^2.3.0","whatwg-url":"^7.0.0","ws":"^6.1.2","xml-name-validator":"^3.0.0"},"deprecated":false,"description":"This is the exact same JSDOM package but with a slight edit to allow custom attribute names. All credits goe to JSDOM developers","devDependencies":{"benchmark":"1.0.0","browserify":"^16.2.3","chai":"^4.2.0","eslint":"^4.19.1","eslint-find-rules":"^3.3.1","eslint-plugin-html":"^5.0.0","js-yaml":"^3.12.0","karma":"^1.7.1","karma-browserify":"^5.3.0","karma-chrome-launcher":"^2.2.0","karma-mocha":"^1.3.0","karma-mocha-webworker":"^1.3.0","karma-sauce-launcher":"^1.2.0","minimatch":"^3.0.4","mocha":"^3.5.2","mocha-sugar-free":"^1.4.0","optimist":"0.6.1","portfinder":"^1.0.20","q":"^1.5.1","rimraf":"^2.6.2","server-destroy":"^1.0.1","st":"^1.2.2","watchify":"^3.11.0","wd":"^1.11.1","webidl2js":"^9.2.0"},"homepage":"https://github.com/jsdom/jsdom#readme","keywords":["dom","html","whatwg","w3c"],"license":"MIT","main":"./lib/api.js","maintainers":[{"name":"hassanzohdy","email":"hassanzohdy@gmail.com"}],"name":"tx-parser","repository":{"type":"git","url":"git+https://github.com/jsdom/jsdom.git"},"version":"1.0.0","bugs":{"url":"https://github.com/jsdom/jsdom/issues"},"_id":"tx-parser@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"hassanzohdy","email":"hassanzohdy@gmail.com"},"dist":{"shasum":"3ed6a675b26a1b98c3b5a7554499b4d2e27de3b7","size":282617,"noattachment":false,"tarball":"https://registry.npm.taobao.org/tx-parser/download/tx-parser-1.0.0.tgz"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tx-parser_1.0.0_1548810071600_0.22490407277528823"},"_hasShrinkwrap":false,"publish_time":1548810071771,"_cnpm_publish_time":1548810071771}},"readme":"

\n \"\"
\n jsdom\n

\n\njsdom is a pure-JavaScript implementation of many web standards, notably the WHATWG [DOM](https://dom.spec.whatwg.org/) and [HTML](https://html.spec.whatwg.org/multipage/) Standards, for use with Node.js. In general, the goal of the project is to emulate enough of a subset of a web browser to be useful for testing and scraping real-world web applications.\n\nThe latest versions of jsdom require Node.js v8 or newer. (Versions of jsdom below v12 still work with Node.js v6, but are unsupported.)\n\n## Basic usage\n\n```js\nconst jsdom = require(\"jsdom\");\nconst { JSDOM } = jsdom;\n```\n\nTo use jsdom, you will primarily use the `JSDOM` constructor, which is a named export of the jsdom main module. Pass the constructor a string. You will get back a `JSDOM` object, which has a number of useful properties, notably `window`:\n\n```js\nconst dom = new JSDOM(`

Hello world

`);\nconsole.log(dom.window.document.querySelector(\"p\").textContent); // \"Hello world\"\n```\n\n(Note that jsdom will parse the HTML you pass it just like a browser does, including implied ``, ``, and `` tags.)\n\nThe resulting object is an instance of the `JSDOM` class, which contains a number of useful properties and methods besides `window`. In general it can be used to act on the jsdom from the \"outside,\" doing things that are not possible with the normal DOM APIs. For simple cases, where you don't need any of this functionality, we recommend a coding pattern like\n\n```js\nconst { window } = new JSDOM(`...`);\n// or even\nconst { document } = (new JSDOM(`...`)).window;\n```\n\nFull documentation on everything you can do with the `JSDOM` class is below, in the section \"`JSDOM` Object API\".\n\n## Customizing jsdom\n\nThe `JSDOM` constructor accepts a second parameter which can be used to customize your jsdom in the following ways.\n\n### Simple options\n\n```js\nconst dom = new JSDOM(``, {\n url: \"https://example.org/\",\n referrer: \"https://example.com/\",\n contentType: \"text/html\",\n includeNodeLocations: true,\n storageQuota: 10000000\n});\n```\n\n- `url` sets the value returned by `window.location`, `document.URL`, and `document.documentURI`, and affects things like resolution of relative URLs within the document and the same-origin restrictions and referrer used while fetching subresources. It defaults to `\"about:blank\"`.\n- `referrer` just affects the value read from `document.referrer`. It defaults to no referrer (which reflects as the empty string).\n- `contentType` affects the value read from `document.contentType`, and how the document is parsed: as HTML or as XML. Values that are not `\"text/html\"` or an [XML mime type](https://html.spec.whatwg.org/multipage/infrastructure.html#xml-mime-type) will throw. It defaults to `\"text/html\"`.\n- `includeNodeLocations` preserves the location info produced by the HTML parser, allowing you to retrieve it with the `nodeLocation()` method (described below). It also ensures that line numbers reported in exception stack traces for code running inside `\n`);\n\n// The script will not be executed, by default:\ndom.window.document.body.children.length === 1;\n```\n\nTo enable executing scripts inside the page, you can use the `runScripts: \"dangerously\"` option:\n\n```js\nconst dom = new JSDOM(`\n \n`, { runScripts: \"dangerously\" });\n\n// The script will be executed and modify the DOM:\ndom.window.document.body.children.length === 2;\n```\n\nAgain we emphasize to only use this when feeding jsdom code you know is safe. If you use it on arbitrary user-supplied code, or code from the Internet, you are effectively running untrusted Node.js code, and your machine could be compromised.\n\nIf you want to execute _external_ scripts, included via `\n```\n\nIf you do not control the page, you could try workarounds such as polling for the presence of a specific element.\n\nFor more details, see the discussion in [#640](https://github.com/tmpvar/jsdom/issues/640), especially [@matthewkastor](https://github.com/matthewkastor)'s [insightful comment](https://github.com/tmpvar/jsdom/issues/640#issuecomment-22216965).\n\n### Shared constructors and prototypes\n\nAt the present time, for most web platform APIs, jsdom shares the same class definition between multiple seemingly-independent jsdoms. That means that, for example, the following situation can occur:\n\n```js\nconst dom1 = new JSDOM();\nconst dom2 = new JSDOM();\n\ndom1.window.Element.prototype.expando = \"blah\";\nconsole.log(dom2.window.document.createElement(\"frameset\").expando); // logs \"blah\"\n```\n\nThis is done mainly for performance and memory reasons: creating separate copies of all the many classes on the web platform, each time we create a jsdom, would be rather expensive.\n\nNevertheless, we remain interested in one day providing an option to create an \"independent\" jsdom, at the cost of some performance.\n\n### Unimplemented parts of the web platform\n\nAlthough we enjoy adding new features to jsdom and keeping it up to date with the latest web specs, it has many missing APIs. Please feel free to file an issue for anything missing, but we're a small and busy team, so a pull request might work even better.\n\nBeyond just features that we haven't gotten to yet, there are two major features that are currently outside the scope of jsdom. These are:\n\n- **Navigation**: the ability to change the global object, and all other objects, when clicking a link or assigning `location.href` or similar.\n- **Layout**: the ability to calculate where elements will be visually laid out as a result of CSS, which impacts methods like `getBoundingClientRects()` or properties like `offsetTop`.\n\nCurrently jsdom has dummy behaviors for some aspects of these features, such as sending a \"not implemented\" `\"jsdomError\"` to the virtual console for navigation, or returning zeros for many layout-related properties. Often you can work around these limitations in your code, e.g. by creating new `JSDOM` instances for each page you \"navigate\" to during a crawl, or using `Object.defineProperty()` to change what various layout-related getters and methods return.\n\nNote that other tools in the same space, such as PhantomJS, do support these features. On the wiki, we have a more complete writeup about [jsdom vs. PhantomJS](https://github.com/tmpvar/jsdom/wiki/jsdom-vs.-PhantomJS).\n\n## Getting help\n\nIf you need help with jsdom, please feel free to use any of the following venues:\n\n- The [mailing list](http://groups.google.com/group/jsdom) (best for \"how do I\" questions)\n- The [issue tracker](https://github.com/tmpvar/jsdom/issues) (best for bug reports)\n- The IRC channel: [#jsdom on freenode](irc://irc.freenode.net/jsdom)\n","_attachments":{},"homepage":"https://github.com/jsdom/jsdom#readme","bugs":{"url":"https://github.com/jsdom/jsdom/issues"},"license":"MIT"}