From 4f1ed14f07c1373bc5734a12bbb3203c1b07a2bd Mon Sep 17 00:00:00 2001 From: siikamiika Date: Mon, 10 Feb 2020 21:56:48 +0200 Subject: [PATCH] simplify TemplateHandler --- ext/mixed/js/template-handler.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ext/mixed/js/template-handler.js b/ext/mixed/js/template-handler.js index 86e2414f..a5a62937 100644 --- a/ext/mixed/js/template-handler.js +++ b/ext/mixed/js/template-handler.js @@ -20,15 +20,9 @@ class TemplateHandler { constructor(html) { this._templates = new Map(); - this._html = html; - this._doc = null; - this._initialize(); - } - - _initialize() { - this._doc = new DOMParser().parseFromString(this._html, 'text/html'); - for (const template of this._doc.querySelectorAll('template')) { + const doc = new DOMParser().parseFromString(html, 'text/html'); + for (const template of doc.querySelectorAll('template')) { this._setTemplate(template); } }