Skip to content

William-An/HTML-Differences

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

TODO Goals

[] Better performance

Releases

No releases published

Packages