Add support for HTMLTemplateElement

For browsers that has native support for template elements we just need to
ensure that content is wrapped. For other browsers we move the template content
into a document fragment as required by the template spec.