Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
/ dom-jsx-runtime Public archive

A tiny library that turns JSX into DOM operations

License

Notifications You must be signed in to change notification settings

jed/dom-jsx-runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dom-jsx-runtime

A tiny library that turns JSX into DOM operations

Usage

This library uses React's new JSX transform, so all you need to do is configure your build tool to use https://esm.sh/dom-jsx-runtime for jsxImportSource.

In Deno, for example, your deno.json file should look like this:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "https://esm.sh/dom-jsx-runtime"
  }
}

Example

From the test, run via deno test:

import {assertEquals} from 'https://deno.land/std/testing/asserts.ts'
import {DOMParser} from 'https://deno.land/x/deno_dom/deno-dom-wasm.ts'
globalThis.document = new DOMParser().parseFromString('', 'text/html')

let dom =
  <html lang='en'>
    <head>
      <title>dom-jsx-runtime</title>
    </head>
    <body>A tiny library that turns JSX into DOM operations</body>
  </html>

let source = dom.outerHTML
let target = '<html lang="en"><head><title>dom-jsx-runtime</title></head><body>A tiny library that turns JSX into DOM operations</body></html>'

Deno.test(
  'Input and output HTML are identical',
  () => assertEquals(source, target)
)

About

A tiny library that turns JSX into DOM operations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published