Add createTemplateFromElement to template

and refactor common code from createTemplateFromElementContents
into createTemplateFromRange