(Bug 51678) Fixed bug in dom-diff algorithm

* The dom-diff algorithm was occasionally recursing into
  template transclusion HTML.  Since transclusion HTML can never
  be directly modified by editors and template updates are
  transmitted via the data-mw object in the wrapper, it is not
  necessary to compare transclusion content.  It can in fact
  introduce bugs as in the itwp examples in the bug report because
  DOM-diff might insert deleted-content-markers and break the
  continuity in template about markers (which is important to
  skip over transclusion content during serialization correctly).

  This bug also only surfaces because of the peculiarities of how
  updated template HTML is modified in VE (see bug report for
  more details).

* Added some documentation to dom-util functions.

* Tested this with HTML (old and edited) dumped from VE via
  Chrome's console.  Verified bug without patch and a fix with
  the patch.

  Currently, we don't have direct dom-diff tests, only indirect
  tests via selser.

  Even if we did have, it would be hard to write a test for this
  bug fix becuase it depends on template content HTML getting
  deleted on edit (see bug report for details).  But, it would be
  possible with a jasmine testing framework which we could consider
  resurrecting.

  To cut a long story short: no change in parsertest results,
  and no new tests added.

Change-Id: I886161d981a0c79b8300d88c5281514b4248cff2