Changed self._is_leaf() check to  check since leaf nodes may still not have text