DjxFragment.ts
10 lines
| 524 B
| video/mp2t
|
TypeScriptLexer
|
|
r112 | import { FunctionRendition } from "./FunctionRendition"; | |
| import { getItemDom } from "./render"; | |||
|
|
r65 | /** Special functional component used to create a document fragment */ | |
|
|
r112 | export const DjxFragment = ({ children }: { children?: unknown | unknown[] }) => | |
| new FunctionRendition(() => { | |||
| const fragment = document.createDocumentFragment(); | |||
| if (children) | |||
| (children instanceof Array ? children : [children]).map(getItemDom).forEach(child => fragment.appendChild(child)); | |||
| return fragment; | |||
| }); |
