Skip to main content

HTMLDOMDiff

Import :

const HTMLDOMDiff = brackets.getModule("language/HTMLDOMDiff")

domdiff(oldNode, newNode) ⇒ Array.<Object>

Generate a list of edits that will mutate oldNode to look like newNode. Currently, there are the following possible edit operations:

  • elementInsert
  • elementDelete
  • elementMove
  • textInsert
  • textDelete
  • textReplace
  • attrDelete
  • attrChange
  • attrAdd
  • rememberNodes (a special instruction that reflects the need to hang on to moved nodes)

Kind: global function
Returns: Array.<Object> - - List of edit operations.

ParamTypeDescription
oldNodeObjectSimpleDOM node with the original content.
newNodeObjectSimpleDOM node with the new content.

domdiff.queuePush()

Adds elements to the queue for generateChildEdits. Only elements (and not text nodes) are added. New nodes (ones that aren't in the old nodeMap), are not added here because they will be added when generateChildEdits creates the elementInsert edit.

Kind: inner method of domdiff

domdiff.addEdits(delta)

Aggregates the child edits in the proper data structures.

Kind: inner method of domdiff

ParamTypeDescription
deltaObjectedits, moves and newElements to add