{"_id":"x-domhandler","_rev":"1-8e407dd77bc8bd61ef0af5b9e1fefe78","name":"x-domhandler","dist-tags":{"latest":"2.4.2"},"versions":{"2.4.2":{"name":"x-domhandler","version":"2.4.2","description":"handler for htmlparser2 that turns pages into a dom","main":"index.js","directories":{"test":"tests"},"scripts":{"test":"mocha -R list && jshint index.js test/"},"repository":{"type":"git","url":"git://github.com/yanghuabei/DomHandler.git"},"keywords":["dom","htmlparser2"],"dependencies":{"domelementtype":"1"},"devDependencies":{"htmlparser2":"^3.9.0","mocha":"^3.0.2","jshint":"^2.9.1"},"author":{"name":"Felix Boehm","email":"me@feedic.com"},"license":"BSD-2-Clause","jshintConfig":{"quotmark":"double","trailing":true,"unused":true,"undef":true,"node":true,"proto":true,"globals":{"it":true}},"gitHead":"9ab081cef256008a72590d5618f08f22e1e1983d","bugs":{"url":"https://github.com/yanghuabei/DomHandler/issues"},"homepage":"https://github.com/yanghuabei/DomHandler#readme","_id":"x-domhandler@2.4.2","_npmVersion":"6.2.0","_nodeVersion":"10.8.0","_npmUser":{"name":"yanghuabei","email":"yanghuabei@outlook.com"},"dist":{"integrity":"sha512-c+T0p5hsahezbHpahjNpSDKjMMwGwOnG6Iaz8zzSjEBlJM47hakZmNBLNpktZJjuRdopoUMPf7HzcPcTE1G0GQ==","shasum":"21afb2d71977118688e49e05c30894497ce3d5e9","tarball":"https://registry.npmjs.org/x-domhandler/-/x-domhandler-2.4.2.tgz","fileCount":33,"unpackedSize":30532,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbeWQQCRA9TVsSAnZWagAA7hkP/1qhtQ3tVyLZQ+zIY6cE\nTKX1NFwRT/IWRL6vU3trIO/9ASiJtOn4knXFX9RP6cBnEyn9QwthZh3WuRCc\n76p30RnkcczXgcDJMR3QYZ4kBIDMRsucNPtnvXjdqds8/hSCIQi/LOt/HNSn\nbBmsFj5F0d82E17gPJMzGAJwh1zwGhiCJP0QSLs0+JIYDAsRYa5h0uk7trWg\nMOtdTIVN8vwJolJ9t9n6k5utt9YkKhGJk6kSbWUccZ1AMnRkeEYGIDd9b2Dn\nC2D7ewdooEa6uFcYUBA+EwqsByvtbLdW6eprWhM9JUKpS/Ni0znmBpzWrlgg\nvmyjsWRRqHNFN6i6SBHF0RFQVv73hRwikKwcU5M6UaI7NMjbpOGPXXw7+DvJ\nVIS8h2lfeSDeuiGjFdblIK9oJJgwllXQScySEaFq70EDcPIsNWZFthYPP22H\n3xMpb8jb/RZfZtuwTDipxn7J4o1zZe17jauzE5VNyvN5s4miZwu3FLoD5kk9\nQJAU5NdVrU8s1QAFD5rHkrPBJ0fwc+7qjLIjHe1MyoWSvETEElVybqb0KHfr\nie6ALo7iMwn7ATCIG2ICOEdWLnt0GPPw4UbaXhs+egb99KCSh/HKtwpvYDKJ\nkZYJEA4c2r8YKnEphNpgNM80kcJuXTz151EIZtOhR2Xpp5ecBbbJx8u5R7Ez\nLufg\r\n=uehX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIESuChyvhDWOwKS67+1blMkaLl1wRKLjedLcSr5LVtIGAiEAoN72IZ8dJ/gXEP9aiB7So4PzYfLK42mdzn2I0i86gyY="}]},"maintainers":[{"name":"yanghuabei","email":"yanghuabei@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/x-domhandler_2.4.2_1534682127554_0.21325039779804666"},"_hasShrinkwrap":false}},"time":{"created":"2018-08-19T12:35:27.553Z","2.4.2":"2018-08-19T12:35:27.665Z","modified":"2022-05-24T20:59:50.983Z"},"maintainers":[{"name":"yanghuabei","email":"yanghuabei@outlook.com"}],"description":"handler for htmlparser2 that turns pages into a dom","homepage":"https://github.com/yanghuabei/DomHandler#readme","keywords":["dom","htmlparser2"],"repository":{"type":"git","url":"git://github.com/yanghuabei/DomHandler.git"},"author":{"name":"Felix Boehm","email":"me@feedic.com"},"bugs":{"url":"https://github.com/yanghuabei/DomHandler/issues"},"license":"BSD-2-Clause","readme":"# domhandler [![Build Status](https://travis-ci.org/yanghuabei/domhandler.svg?branch=master)](https://travis-ci.org/yanghuabei/domhandler)\n\nThe DOM handler (formally known as DefaultHandler) creates a tree containing all nodes of a page. The tree may be manipulated using the [domutils](https://github.com/fb55/domutils) library.\n\n## Differences with origin domhandler\n1. Add `selfClose` flag to node.\n2. Add `singleQuoteAttribs` map to node.\n\nThis project can work with [stricter-htmlparser2](https://github.com/yanghuabei/htmlparser2).\n\n## Usage\n```javascript\nvar handler = new DomHandler([ <func> callback(err, dom), ] [ <obj> options ]);\n// var parser = new Parser(handler[, options]);\n```\n\nAvailable options are described below.\n\n## Example\n```javascript\nvar htmlparser = require(\"htmlparser2\");\nvar rawHtml = \"Xyz <script language= 'javascript'>var foo = '<<bar>>';< /  script><!--<!-- Waah! -- -->\";\nvar handler = new htmlparser.DomHandler(function (error, dom) {\n    if (error)\n    \t[...do something for errors...]\n    else\n    \t[...parsing done, do something...]\n        console.log(dom);\n});\nvar parser = new htmlparser.Parser(handler);\nparser.write(rawHtml);\nparser.end();\n```\n\nOutput:\n\n```javascript\n[{\n    data: 'Xyz ',\n    type: 'text'\n}, {\n    type: 'script',\n    name: 'script',\n    attribs: {\n    \tlanguage: 'javascript'\n    },\n    children: [{\n    \tdata: 'var foo = \\'<bar>\\';<',\n    \ttype: 'text'\n    }]\n}, {\n    data: '<!-- Waah! -- ',\n    type: 'comment'\n}]\n```\n\n## Option: normalizeWhitespace\nIndicates whether the whitespace in text nodes should be normalized (= all whitespace should be replaced with single spaces). The default value is \"false\". \n\nThe following HTML will be used:\n\n```html\n<font>\n\t<br>this is the text\n<font>\n```\n\n### Example: true\n\n```javascript\n[{\n    type: 'tag',\n    name: 'font',\n    children: [{\n    \tdata: ' ',\n    \ttype: 'text'\n    }, {\n    \ttype: 'tag',\n    \tname: 'br'\n    }, {\n    \tdata: 'this is the text ',\n    \ttype: 'text'\n    }, {\n    \ttype: 'tag',\n    \tname: 'font'\n    }]\n}]\n```\n\n### Example: false\n\n```javascript\n[{\n    type: 'tag',\n    name: 'font',\n    children: [{\n    \tdata: '\\n\\t',\n    \ttype: 'text'\n    }, {\n    \ttype: 'tag',\n    \tname: 'br'\n    }, {\n    \tdata: 'this is the text\\n',\n    \ttype: 'text'\n    }, {\n    \ttype: 'tag',\n    \tname: 'font'\n    }]\n}]\n```\n\n## Option: withDomLvl1\n\nAdds DOM level 1 properties to all elements.\n\n<!-- TODO: description -->\n\n## Option: withStartIndices\nIndicates whether a `startIndex` property will be added to nodes. When the parser is used in a non-streaming fashion, `startIndex` is an integer indicating the position of the start of the node in the document. The default value is \"false\".\n\n## Option: withEndIndices\nIndicates whether a `endIndex` property will be added to nodes. When the parser is used in a non-streaming fashion, `endIndex` is an integer indicating the position of the end of the node in the document. The default value is \"false\".\n","readmeFilename":"readme.md"}