initTemplatePolyfill = (forced = false) => {
    if (typeof HTMLTemplateElement !== 'undefined' && !forced) {
        return;
    }
    const contentDoc = document.implementation.createHTMLDocument('template');
    // tslint:disable-next-line:no-any
    const upgrade = (template) => {
        template.content = contentDoc.createDocumentFragment();
        Object.defineProperty(template, 'innerHTML', {
            set: function (text) {
                contentDoc.body.innerHTML = text;
                const content = this.content;
                while (content.firstChild) {
                    content.removeChild(content.firstChild);
                }
                const body = contentDoc.body;
                while (body.firstChild) {
                    content.appendChild(body.firstChild);
                }
            },
            configurable: true
        });
    };
    const capturedCreateElement = Document.prototype.createElement;
    Document.prototype.createElement = function createElement(tagName, options) {
        let el = capturedCreateElement.call(this, tagName, options);
        if (el.localName === 'template') {
            el = capturedCreateElement.call(this, 'div');
            upgrade(el);
        }
        return el;
    };
}
A lightweight <template> polyfill that supports minimum features to cover
lit-html use cases. It provides an alternate route in case <template> is not
natively supported.
Please note that nested template, cloning template node and innerHTML getter
do NOT work with this polyfill.
If it can not fullfill your requirement, please consider using the full
polyfill: https://github.com/webcomponents/template