html-differences

1.3.0 • Public • Published

HTML-Differences

NPM

npm GitHub stars npm Travis

Use XPath and xmlDOM to locate deleted or new HTML Node from string.

Usage

var differ = require("html-differences").differ;
var first = "<p>Helloworld</p>";
var second = "<p>Hello<em>world</em></p>";
var result = differ(first, second);
/**
* result = {
*	equal:[{
*           path:XPath,
*           content:content,
*           attributes:attributes},
*           ...],
*	deleted:[{
*             path:XPath,
*             content:content,
*             attributes:attributes
*            },
*             ...],
*	added:[{
*           path:XPath,
*           content:content,
*           attributes:attributes
*           },
*           ...],
* }
*   attributes:{name:attribute_name,value:attribute_value}
*   e.g.: attribute:{name:'class',value:'button'}
*/

Run Test

npm test

Readme

Keywords

Package Sidebar

Install

npm i html-differences

Weekly Downloads

0

Version

1.3.0

License

MIT

Last publish

Collaborators

  • william_an2000