Skip to content

Commit 2f426d1

Browse files
authored
Use DOM APIs instead of htl hypertext literals (#77)
Fixes #76 It seems the interpretation of `htl` is space sensitive, leading to formatting causing issues with rendering. These changes replace the use of `htl` hepler with just raw DOM, which will not be affected by formatting.
1 parent 19a6148 commit 2f426d1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/clients/DataTable.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ export class DataTable extends MosaicClient {
114114
maxHeight = `${source.height}px`;
115115
}
116116

117-
let tableRoot = html`
118-
<div class="table-container" style="${{ maxHeight }}"></div>
119-
`;
117+
let tableRoot = document.createElement("div");
118+
tableRoot.className = "table-container";
119+
tableRoot.style.maxHeight = maxHeight;
120+
120121
// @deno-fmt-ignore
121122
tableRoot.appendChild(
122123
html.fragment`<table style=${{ tableLayout: "fixed" }}>${this.#thead}${this.#tbody}</table>`
@@ -132,16 +133,16 @@ export class DataTable extends MosaicClient {
132133
}
133134
});
134135

135-
let container = html`
136-
<div class="quak"></div>
137-
`;
136+
let container = document.createElement("div");
137+
container.className = "quak";
138138
container.appendChild(tableRoot);
139-
this.#shadowRoot.appendChild(html`
140-
<style>
141-
${stylesString}
142-
</style>
143-
`);
144139
this.#shadowRoot.appendChild(container);
140+
141+
{
142+
const styles = document.createElement("style");
143+
styles.innerText = stylesString;
144+
this.#shadowRoot.appendChild(styles);
145+
}
145146
}
146147

147148
get #tableRoot(): HTMLDivElement {
@@ -264,9 +265,8 @@ export class DataTable extends MosaicClient {
264265
}
265266

266267
// @deno-fmt-ignore
267-
this.#templateRow = html`<tr><td></td>${
268-
infos.map((info) => html.fragment`<td class=${classes[info.column]}></td>`)
269-
}
268+
this.#templateRow = html`<tr><td></td>${infos.map((info) => html.fragment`<td class=${classes[info.column]}></td>`)
269+
}
270270
<td style=${{ width: "99%", borderLeft: "none", borderRight: "none" }}></td>
271271
</tr>`;
272272

@@ -407,9 +407,9 @@ function thcol(
407407
</svg>`;
408408
let uparrow: SVGPathElement = svg.children[0];
409409
let downarrow: SVGPathElement = svg.children[1];
410-
let verticalResizeHandle: HTMLDivElement = html`
411-
<div class="resize-handle"></div>
412-
`;
410+
let verticalResizeHandle = document.createElement("div");
411+
verticalResizeHandle.className = "resize-handle";
412+
413413
// @deno-fmt-ignore
414414
let sortButton = html`<span aria-role="button" class="sort-button" onmousedown=${nextSortState}>${svg}</span>`;
415415
// @deno-fmt-ignore

0 commit comments

Comments
 (0)