Updating DOMElement attribute; but fail when adding text child