html2wt/DOMDiff~DOMDiff(env)

A DOM diff helper class.

Compares two DOMs and annotates a copy of the passed-in DOM with change information for the selective serializer.

Show:

Constructor

new DOMDiff(env)

...
Parameters:
Name Type Description
env MWParserEnvironment
Source:

Methods

dataMWEquals()

Test if two data-mw objects are identical.

Test if two data-mw objects are identical.

  • independent of order of attributes in data-mw
  • html attributes are parsed to DOM and recursively compared
  • for id attributes, the DOM fragments are fetched and compared.
Source:

diff()

Diff two HTML documents, and add / update data-parsoid-diff attributes with change information.

Diff two HTML documents, and add / update data-parsoid-diff attributes with change information.

Source:

doDOMDiff()

Diff two DOM trees by comparing them node-by-node.

Diff two DOM trees by comparing them node-by-node.

TODO: Implement something more intelligent like http://gregory.cobena.free.fr/www/Publications/%5BICDE2002%5D%20XyDiff%20-%20published%20version.pdf, which uses hash signatures of subtrees to efficiently detect moves / wrapping.

Adds / updates a data-parsoid-diff structure with change information.

Returns true if subtree is changed, false otherwise.

TODO: Assume typical CSS white-space, so ignore ws diffs in non-pre content.

Source:

treeEquals(nodeA, nodeB, deep) → {boolean}

Test if two DOM nodes are equal.

Test if two DOM nodes are equal.

Parameters:
Name Type Description
nodeA Node
nodeB Node
deep boolean
Source:
Returns:
Type
boolean