UNPKG

pagehtml

Version:

A tool to grab and process a website's html.

640 lines (178 loc) 7.66 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Global</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Global</h1> <section> <header> <h2></h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="getElementText"><span class="type-signature"></span>getElementText<span class="signature">(dom, elementString)</span><span class="type-signature"> &rarr; {Array.&lt;{elementText: string, nodeName: string, outerHTML: string, innerHTML: string, parentElement: string}>}</span></h4> <div class="description"> <p>Takes a document object model (dom) and a target element string and returns the text content of that element.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>dom</code></td> <td class="type"> <span class="param-type">jsdom.JSDOM</span> </td> <td class="description last"><p>The document object model, an instance of the JSDOM class.</p></td> </tr> <tr> <td class="name"><code>elementString</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>The HTML element to query.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utils_getElement.js.html">utils/getElement.js</a>, <a href="utils_getElement.js.html#line21">line 21</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>elementText: an array of objects containing relevant element information.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;{elementText: string, nodeName: string, outerHTML: string, innerHTML: string, parentElement: string}></span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>```javascript // Search the dom for div element with id 'container'. let elementString = "div#container" getElementText(dom,elementString) ``` This will return any text content in the container element.</code></pre> <h4 class="name" id="getLinks"><span class="type-signature"></span>getLinks<span class="signature">(dom)</span><span class="type-signature"> &rarr; {Array.&lt;{href: string, nodeName: string, outerHTML: string, innerHTML: string, parentElement: string}>}</span></h4> <div class="description"> <p>Takes an instance of the JSDOM class and returns all href links.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>dom</code></td> <td class="type"> <span class="param-type">jsdom.JSDOM</span> </td> <td class="description last"><p>The document object model, an instance of the JSDOM class.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utils_getLinks.js.html">utils/getLinks.js</a>, <a href="utils_getLinks.js.html#line11">line 11</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>links: an array of objects containing relevant link information.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;{href: string, nodeName: string, outerHTML: string, innerHTML: string, parentElement: string}></span> </dd> </dl> <h4 class="name" id="makeTable"><span class="type-signature"></span>makeTable<span class="signature">(dom)</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4> <div class="description"> <p>Takes an instance of the JSDOM class and returns all html tables as an array of arrays.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>dom</code></td> <td class="type"> <span class="param-type">jsdom.JSDOM</span> </td> <td class="description last"><p>The document object model, an instance of the JSDOM class.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="utils_makeTable.js.html">utils/makeTable.js</a>, <a href="utils_makeTable.js.html#line6">line 6</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>tables</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;string></span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="PageHTML.html">PageHTML</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getElementText">getElementText</a></li><li><a href="global.html#getLinks">getLinks</a></li><li><a href="global.html#makeTable">makeTable</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Wed Feb 05 2025 14:23:55 GMT-0800 (Pacific Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>