Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create text node for hypertext element of type bigint or symbol #338

Merged
merged 4 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/hyper-dom-expressions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export function createHyperScript(r: Runtime): HyperScript {
} else if (
"number" === type ||
"boolean" === type ||
"bigint" === type ||
"symbol" === type ||
l instanceof Date ||
l instanceof RegExp
) {
Expand Down
4 changes: 3 additions & 1 deletion packages/hyper-dom-expressions/test/hyperscript.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as r from "dom-expressions/src/client";
const h = createHyperScript(r);

const FIXTURES = [
'<div id="main"><h1>Welcome</h1><span style="color: rgb(85, 85, 85);">555</span><label for="entry" class="name">Edit:</label><input id="entry" type="text" readonly=""></div>',
'<div id="main"><h1>Welcome</h1><p>10Symbol($)</p><span style="color: rgb(85, 85, 85);">555</span><label for="entry" class="name">Edit:</label><input id="entry" type="text" readonly=""></div>',
'<div id="main" refset="true" class="selected"><h1 title="hello" style="background-color: red;"><a href="/">Welcome</a></h1></div>',
'<div id="main"><button>Click Bound</button><button>Click Delegated</button><button>Click Listener</button></div>',
"<div>First</div>middle<div>Last</div>",
Expand All @@ -16,8 +16,10 @@ const FIXTURES = [

describe("Test HyperScript", () => {
test("Simple Elements", () => {
const dollar = Symbol('$');
const template = h("#main", [
h("h1", "Welcome"),
h('p', 10n, dollar),
h("span", { style: "color: #555" }, 555),
h("label.name", { htmlFor: "entry" }, "Edit:"),
h("input#entry", { type: "text", readonly: true })
Expand Down
Loading