simplify TemplateHandler

This commit is contained in:
siikamiika 2020-02-10 21:56:48 +02:00
parent b7f347ff4f
commit 4f1ed14f07

View File

@ -20,15 +20,9 @@
class TemplateHandler { class TemplateHandler {
constructor(html) { constructor(html) {
this._templates = new Map(); this._templates = new Map();
this._html = html;
this._doc = null;
this._initialize(); const doc = new DOMParser().parseFromString(html, 'text/html');
} for (const template of doc.querySelectorAll('template')) {
_initialize() {
this._doc = new DOMParser().parseFromString(this._html, 'text/html');
for (const template of this._doc.querySelectorAll('template')) {
this._setTemplate(template); this._setTemplate(template);
} }
} }