From 07260049cc639435281706a21b45b10aeac1576e Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 23 Mar 2016 23:49:58 +0500 Subject: [PATCH] add flag to getElem() to search in templates too --- js/interface_common.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/interface_common.js b/js/interface_common.js index 419ddfe..ff50e72 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -24,13 +24,19 @@ var _watchHashChangeRelaxDontDoIt = window.location.hash === '' ? true : false; // and actually I'm talking about 'so called \'detached\'' elements which appended to twister.html.detached // we may just append twister.html.detached to document instead and remove this weird shit (or I need to // improve my google skills to find native jQuery way to dig through all detached elemets with one query) -function getElem(req) { +function getElem(req, searchInTmpl) { var elem = $(req); var h = twister.html.detached.find(req); for (var i = 0; i < h.length; i++) elem[elem.length++] = h[i]; + if (searchInTmpl) { + h = twister.tmpl.root.find(req); + for (var i = 0; i < h.length; i++) + elem[elem.length++] = h[i]; + } + return elem; }