Skip to content

Commit 3de518e

Browse files
committed
Bugfixes
1 parent 928ff9a commit 3de518e

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

tApp.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class tApp {
99
static currentHash = "/";
1010
static debugComponentTiming;
1111
static get version() {
12-
return "v0.10.9";
12+
return "v0.10.10";
1313
}
1414
static configure(params) {
1515
if(params == null) {
@@ -589,8 +589,10 @@ class tApp {
589589
}
590590
}
591591
prevNotNull.after(afterChildren[i]);
592+
beforeChildren[i] = afterChildren[i];
592593
} else {
593594
nextNotNull.before(afterChildren[i]);
595+
beforeChildren[i] = afterChildren[i];
594596
}
595597
}
596598
} else if(afterChildren[i] == null) {
@@ -659,7 +661,25 @@ class tApp {
659661
}
660662
let domRendered = htmlToDOM(rendered);
661663
domRendered.setAttribute("tapp-component", component.id);
662-
rendered = tApp.unescape(domRendered.outerHTML);
664+
rendered = domRendered.outerHTML;
665+
let it = rendered.matchAll(new RegExp("{{{[\\s|\\t]*(.+?(?=}}}))[\\s|\\t]*}}}", "g"));
666+
let next = it.next();
667+
while(!next.done) {
668+
rendered = rendered.replace(next.value[0], tApp.unescape(next.value[0]));
669+
next = it.next();
670+
}
671+
it = rendered.matchAll(new RegExp("{%[\\s|\\t]*(.+?(?=%}))[\\s|\\t]*%}", "g"));
672+
next = it.next();
673+
while(!next.done) {
674+
rendered = rendered.replace(next.value[0], tApp.unescape(next.value[0]));
675+
next = it.next();
676+
}
677+
it = rendered.matchAll(new RegExp("\\[\\[[\\s|\\t]*(.+?(?=\\]\\]))[\\s|\\t]*\\]\\]", "g"));
678+
next = it.next();
679+
while(!next.done) {
680+
rendered = rendered.replace(next.value[0], tApp.unescape(next.value[0]));
681+
next = it.next();
682+
}
663683
return tApp.compileTemplate(rendered, {
664684
props: props,
665685
state: component.state,
@@ -1181,6 +1201,9 @@ tApp.Component = class {
11811201
toString() {
11821202
return tApp.compileComponent(this);
11831203
}
1204+
elements() {
1205+
return document.querySelectorAll(`[tapp-component="${this.#id}"]`);
1206+
}
11841207
}
11851208

11861209
tApp.GlobalComponent = (function() {

0 commit comments

Comments
 (0)