snippet-from-dom-element
TypeScript icon, indicating that this package has built-in type declarations

0.5.2 • Public • Published

Snippet from dom element

GitHub license GitHub release GitHub contributors GitHub issues GitHub pull-requests saythanks

Description

This tool to get a snippet from the dom element. The snippet has original open-close HTML tag with attributes and truncated inner text.

Install

For npm:

npm install --save snippet-from-dom-element

For yarn:

yarn add snippet-from-dom-element

Example

import getSnippetFromDomElement from 'snippet-from-dom-element'
 
const element = document.querySelector('#main-news-title');
const innerContentLength = 10;
const snippet = getSnippetFromDomElement(element, innerContentLength);
console.log(snippet);
// <h2 id="main-news-title">Breaking n...</h2>

License

MIT licensed.

/snippet-from-dom-element/

    Package Sidebar

    Install

    npm i snippet-from-dom-element

    Weekly Downloads

    15

    Version

    0.5.2

    License

    MIT

    Unpacked Size

    7.22 kB

    Total Files

    6

    Last publish

    Collaborators

    • rdashevsky