a post-component library for building user-interfaces on the web.

more trivial refactors (#57)

authored by tombl.dev and committed by

GitHub dd74b1fc 60828df8

+6 -6
+2 -2
src/client/compiler.ts
··· 38 38 function patch( 39 39 node: DocumentFragment | HTMLElement | SVGElement, 40 40 idx: number, 41 - createPart: (node: Node | Span, span: Span) => Part, 41 + create_part: (node: Node | Span, span: Span) => Part, 42 42 ) { 43 43 assert(next_part < compiled._parts.length, 'got more parts than expected') 44 44 if (is_document_fragment(node)) compiled._root_parts.push(next_part) 45 45 else if ('dynparts' in node.dataset) node.dataset.dynparts += ' ' + next_part 46 46 // @ts-expect-error -- this assigment will cast nextPart to a string 47 47 else node.dataset.dynparts = next_part 48 - compiled._parts[next_part++] = [idx, createPart] 48 + compiled._parts[next_part++] = [idx, create_part] 49 49 } 50 50 51 51 const walker = document.createTreeWalker(template_element.content, __DEV__ ? 133 : 5)
+2 -2
src/client/tests/setup.ts
··· 4 4 5 5 GlobalRegistrator.register() 6 6 7 - export function setup(initialHtml = ''): { root: Root; el: HTMLDivElement } { 7 + export function setup(initial_html = ''): { root: Root; el: HTMLDivElement } { 8 8 const el = document.createElement('div') 9 - el.innerHTML = initialHtml 9 + el.innerHTML = initial_html 10 10 document.body.appendChild(el) 11 11 12 12 const root = createRoot(el)
+2 -2
src/server.ts
··· 76 76 ontext(start, end) { 77 77 const value = html.slice(start, end) 78 78 79 - for (const match of [...value.matchAll(DYNAMIC_GLOBAL)]) { 79 + for (const match of value.matchAll(DYNAMIC_GLOBAL)) { 80 80 const idx = parseInt(match[1]) 81 81 parts.push({ 82 82 start: start + match.index, ··· 96 96 oncomment(start, end) { 97 97 const value = html.slice(start, end) 98 98 99 - for (const match of [...value.matchAll(DYNAMIC_GLOBAL)]) { 99 + for (const match of value.matchAll(DYNAMIC_GLOBAL)) { 100 100 const idx = parseInt(match[1]) 101 101 parts.push({ 102 102 start: start + match.index,