Efficient implementation of replaceChild and fragment insertion
Efficient implementation of replaceChild and fragment insertion

Array.splice() is typically O(N) in the number of elements which need to
be moved. This means that node insertion and removal can be very expensive.
So:

* Implement replaceChild() by overwriting the relevant element in
  childNodes, instead of deleting and then re-inserting.
* Introduced a new helper function _insertOrReplace(), since the
  implementations now only differ in a few places.
* When inserting a document fragment, add the nodes to the array in
  bulk, with a single Array.splice(), instead of adding them one at a
  time. This also allows us to conveniently fix the fixme comment:
  document fragment insertion is now atomic from the point of view of
  mutation handlers.

Also:
* Remove unused variable curidx

fgnass/domino,fgnass/domino,cscott/domino,arlolra/domino,cscott/domino,arlolra/domino