Move the various getDirectChild functions to DomUtils.getDirectChild.

This removes duplicate code.