implement Template::attachTo for Text, Comment, and Element