Skip to content

Commit

Permalink
Create text node for hypertext element of type bigint or symbol (#338)
Browse files Browse the repository at this point in the history
* Support a combination of classes defined with dot syntax and as property

* Create text node for hypertext element of type bigint or symbol
  • Loading branch information
wrnrlr authored Aug 15, 2024
1 parent 0456697 commit 4fe6198
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit 4fe6198

Please sign in to comment.