# typescript-domhelper

> HTML DOM helper for Typescript

Latest version **1.1.0** (published 2017-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install typescript-domhelper
pnpm add typescript-domhelper
yarn add typescript-domhelper
bun add typescript-domhelper
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-02-08 |
| First published | 2017-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | DZ Chan |
| Maintainers | okcdz |
| Keywords | typescript, dom |

## Links

- npm: https://www.npmjs.com/package/typescript-domhelper
- Repository: https://github.com/ChannelOne/typescript-domhelper
- Homepage: https://github.com/ChannelOne/typescript-domhelper#readme
- Issues: https://github.com/ChannelOne/typescript-domhelper/issues
- npm.io page: https://npm.io/package/typescript-domhelper

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-02-08
- 1.0.4 — 2017-02-07
- 1.0.3 — 2017-02-07
- 1.0.2 — 2017-02-07
- 1.0.1 — 2017-02-07
- 1.0.0 — 2017-02-07

## README

# Typescript DOM helper
DOM helper for Typescript.

The `elem` method is powerful for dom generation,
it also has alias called `element`.

## Install

```
npm i typescript-domhelper
```

## Powerful element generation

Usage:

```typescript

import {elem, element, text} from "typescript-domhelper"

let myElement1 = elem("p");

let myElement3 = element("a", "", { // the same as above
    id: "myAnchor"
});

let myElement5: HTMLElement;

let myElement6: HTMLElement;

let myElement4 = elem("div", "container", null, [
    myElement5 = elem("div", "container", null, [
        myElement6 = elem("p", "", null, [
            text("Hello world!")
        ],
        myElement3,
    ]
]);

```

## Powerful typed element generation

The `Dom` class api have the same parameters as `elem`,  but it can specific the type of the return value, it contains **all** the elements of HTML.

Usage:

```typescript
import {Dom} from "typescript-domhelper"

let myDiv = Dom.Div("container"); // the type of `myDiv` is HTMLDivElement

let myImg: HTMLImageElement = Dom.Img(null, {id: "myImage"}); // HTMLImageElement
```

Relied on the type system of Typescript, you can write code more easily.

---
_Source: https://npm.io/package/typescript-domhelper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
