changed children to contents to support text nodes

Changed the .children to .contents to support text nodes.