html-differences
v1.3.0
Published
A simple package to detect changes in different html, using xpath
Downloads
5
Readme
HTML-Differences
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