get tests passing

pull/4863/head
Richard Harris 5 years ago
parent 215c5e62e1
commit 236fd67f74

@ -321,21 +321,25 @@ export class HtmlTag {
constructor(anchor: HTMLElement = null) { constructor(anchor: HTMLElement = null) {
this.a = anchor; this.a = anchor;
this.e = this.n = null;
} }
m(html: string, target: HTMLElement, anchor: HTMLElement = null) { m(html: string, target: HTMLElement, anchor: HTMLElement = null) {
if (!this.e) { if (!this.e) {
this.e = element(target.nodeName as keyof HTMLElementTagNameMap); this.e = element(target.nodeName as keyof HTMLElementTagNameMap);
this.t = target; this.t = target;
this.h(html);
} }
this.u(html, anchor); this.i(anchor);
} }
u(html: string, anchor) { h(html) {
this.e.innerHTML = html; this.e.innerHTML = html;
this.n = Array.from(this.e.childNodes); this.n = Array.from(this.e.childNodes);
}
i(anchor) {
for (let i = 0; i < this.n.length; i += 1) { for (let i = 0; i < this.n.length; i += 1) {
insert(this.t, this.n[i], anchor); insert(this.t, this.n[i], anchor);
} }
@ -343,7 +347,8 @@ export class HtmlTag {
p(html: string) { p(html: string) {
this.d(); this.d();
this.u(html, this.a); this.h(html);
this.i(this.a);
} }
d() { d() {

@ -53,7 +53,7 @@ function create_each_block(ctx) {
t5 = text(" ago:"); t5 = text(" ago:");
t6 = space(); t6 = space();
attr(span, "class", "meta"); attr(span, "class", "meta");
html_tag = new HtmlTag(raw_value, null); html_tag = new HtmlTag(null);
attr(div, "class", "comment"); attr(div, "class", "comment");
}, },
m(target, anchor) { m(target, anchor) {
@ -67,7 +67,7 @@ function create_each_block(ctx) {
append(span, t4); append(span, t4);
append(span, t5); append(span, t5);
append(div, t6); append(div, t6);
html_tag.m(div); html_tag.m(raw_value, div);
}, },
p(ctx, dirty) { p(ctx, dirty) {
if (dirty & /*comments*/ 1 && t2_value !== (t2_value = /*comment*/ ctx[4].author + "")) set_data(t2, t2_value); if (dirty & /*comments*/ 1 && t2_value !== (t2_value = /*comment*/ ctx[4].author + "")) set_data(t2, t2_value);

Loading…
Cancel
Save