th; i++) {
      clone.appendChild(subfrag.childNodes[i]);
    }
  }

  // "For each contained child in contained children:"
  for (var i = 0; i < containedChildren.length; i++) {
    // "Let clone be the result of calling cloneNode(true) of contained
    // child."
    var clone = containedChildren[i].cloneNode(true);

    // "Append clone as the last child of frag."
    frag.appendChild(clone);
  }

  // "If last partially contained child is a Text, ProcessingInstruction, or Comment node:"
  if (lastParti