mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-14 17:07:53 +00:00
add flag to getElem() to search in templates too
This commit is contained in:
parent
0d902c1ea6
commit
07260049cc
@ -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
|
// 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
|
// 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)
|
// 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 elem = $(req);
|
||||||
var h = twister.html.detached.find(req);
|
var h = twister.html.detached.find(req);
|
||||||
|
|
||||||
for (var i = 0; i < h.length; i++)
|
for (var i = 0; i < h.length; i++)
|
||||||
elem[elem.length++] = h[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;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user