Skip to content

Commit

Permalink
Merge pull request #43 from ConnorJamesLow/release/v0.8.0
Browse files Browse the repository at this point in the history
Release/v0.8.0
  • Loading branch information
ConnorJamesLow authored Mar 9, 2023
2 parents 4b51b66 + 83c4e5e commit de52b1b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "texsaur",
"version": "0.7.1",
"version": "0.8.0",
"description": "",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
Expand Down
11 changes: 11 additions & 0 deletions package/src/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ describe('jsx: intrinsic elements', () => {
expect(div.classList[0]).to.equal('foo');
expect(div.className).to.equal('foo');
})

it('can accept HTMLCollections as children', () => {
const parent = <div class="parent">
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
</div>
const container = <section>{parent.children}</section>
expect(container.children).to.have.a.lengthOf(3);
expect(container.children[2].className).to.equal("child");
})
});

describe('jsx: fragments', () => {
Expand Down
4 changes: 2 additions & 2 deletions package/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as svg from './svg';
function __jsx<T extends JSX.HTMLTag = JSX.HTMLTag>(tag: T, properties: RecursivePartial<JSX.IntrinsicElements[T]> | null, ...children: Node[]): HTMLElement
function __jsx<T extends JSX.SVGTag = JSX.SVGTag>(tag: T, properties: RecursivePartial<JSX.IntrinsicElements[T]> | null, ...children: Node[]): SVGElement
function __jsx(tag: JSX.Component, properties: Parameters<typeof tag> | null, ...children: Node[]): Node
function __jsx(tag: JSX.Tag | JSX.Component, properties: { [key: string]: any } | null, ...children: Node[]) {
function __jsx(tag: JSX.Tag | JSX.Component, properties: { [key: string]: any } | null, ...children: any[]) {
const { document, Node } = JsxDom;

if (typeof tag === 'function') {
Expand Down Expand Up @@ -84,7 +84,7 @@ function __jsx(tag: JSX.Tag | JSX.Component, properties: { [key: string]: any }
element.appendChild(child);
continue;
}
if (Array.isArray(child)) {
if (typeof child !== 'string' && child?.[Symbol.iterator]) {
element.append(...child);
continue;
}
Expand Down

0 comments on commit de52b1b

Please sign in to comment.