But i think your createContent method does when template.content is not available.
May i suggest you to create content in another document (in the case where template.content is not supported):
document.cloneNode().createElement(...)
This will, as expected from content obtained through template.content, need to be imported back to root document.