Merge significant portions of the DomTree and PostDomTree implementations.