Diff and patch engine for DOM trees
npm install deltajs
|2||downloads in the last month|
|Version||0.0.3 last updated 2 years ago|
|Dependencies||mime, optparse, xmlshim|
- node.js: Tested with version 0.4.12
- npm: Tested with version 1.0.106
- GNU make
The instructions have been tested on Linux. They probably also work on Mac OS X machines with installed XCode Developer Tools. There is currently no support for Microsoft Windows.
Build instructions for node.js
Delta.js runs within modern web browsers as well as under node.js. In order to
use it as a module for node.js based projects, just drop this directory into an
appropriate module path. For example the
node\_modules folder of your
The delta.js source directory is organized as an npm package. Invoking the
npm install will download any dependencies and install them into the
It is recommended to verify the installation by running the automated test
suite once by invoking
Building AMD modules
In order to build a version suitable for AMD module loaders like dojo or
make amd. The built modules are put into the directory
Building single file browser version
A single-file browser version of the framework can be built using the command
make browser. The result is placed into
dist/browser/delta.js. Note that
this version is not compatible with AMD modules.
Running the command line version
The command line utilities are located in the
bin directory. They may be
invoked directly without a prior build. There are some sample XML files in
test/fixtures which are useful to quickly test the command line interfaces.
Follow this example in order to produce a patch by diffing two versions of an XML file as well as apply it afterwards back to the original version.
./bin/djdiff.js -p xml ./test/fixtures/logo-1.svg ./test/fixtures/logo-2.svg > /tmp/logo-diff.xml ./bin/djpatch.js -p xml ./test/fixtures/logo-1.svg /tmp/logo-diff.xml > /tmp/logo-1-patched.svg
/tmp/logo-diff.xml will contain the changes between
logo-2.svg while the file
/tmp/logo-1-patched.svg will contain the same
Running the browser based examples
In order to build the examples, invoke
make examples. Run
node scripts/http.js examples/lcs in order to start a local webserver for the
LCS example. Then point your browser at http://localhost:3000 in order to
access the LCS web application.
The following examples are available:
example/lcsA visualization of Myers Longest Common Subsequence algorithm.
example/xccA web application allowing to step through the XCC tree matching algorithm.
example/srcdiffGiven two versions of an XML file, this web application will highlight the differencies on the XML source code.
example/vizmerge/srcA web application allowing diffing and selectively merging of changes in XMl documents. This demo application also features a live preview where the effects of a change are shown in realtime.
Bulding the API reference
In order to build the API reference, the Python Documentation Generatior Sphinx
and the jsdoc toolkit version 2 is required. After invoking
make doc, the
doc/\_build/html contains the built documentation in HTML format.