actualAllNodes[j].parentNode) {
        actualRoots.push(actualAllNodes[j]);
      }
    }

    expectedRoots = [];
    for (var j = 0; j < expectedAllNodes.length; j++) {
      if (!expectedAllNodes[j].parentNode) {
        expectedRoots.push(expectedAllNodes[j]);
      }
    }

    for (var j = 0; j < actualRoots.length; j++) {
      assertNodesEqual(actualRoots[j], expectedRoots[j], j ? "detached node #" + j : "tree root");

      if (j == 0) {
        // Clearly something is wrong if the node lists are 