0.5.2 • Published 4 years ago

snippet-from-dom-element v0.5.2

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

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.

0.5.2

4 years ago

0.5.1

4 years ago

0.2.0

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.1.0

4 years ago