# @antv/dom-util

> A common util collection for antv projects

Latest version **2.0.4** (published 2022-01-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @antv/dom-util
pnpm add @antv/dom-util
yarn add @antv/dom-util
bun add @antv/dom-util
```

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2022-01-25 |
| First published | 2019-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 36 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 72 |
| Author | https://github.com/orgs/antvis/people |
| Maintainers | rainy25ghz, zeyuwang, yanxiong, susiwen8, freestyle21, soundquiet, elaine.q.10, sturuby, lviser, sakuya223, serializedowen, xdzhao, yangzhanmei, wjgogogo, leungwensen, dori, iaaron, yard, simaq, dxq613, intchous, susan_ann, jinke.li, lzxue, army8735, atool, baizn, dengfuping, neoddish, jeffy2012, zqlu, afc163, pomelo-nwu, kopiluwaky, ccnuzindex, panyuqi, bubkoo, zengyue, kasmine, boyu.zlj, l1ud0ngq1, newbyvector, winniexing, chenluli, kn9117, xdddst, semious2020, esora, nadia_liu, bbsqq, mxz96102, openwayne, pearmini, pddpd, yiqianyao, zhanba, cxxxxxn |
| Keywords | util, antv, g |

## Links

- npm: https://www.npmjs.com/package/@antv/dom-util
- Repository: https://github.com/antvis/util
- Homepage: https://github.com/antvis/util#readme
- Issues: https://github.com/antvis/util/issues
- npm.io page: https://npm.io/package/@antv/dom-util

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.0.3

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 2.0.4 (latest) — 2022-01-25
- 2.0.3 — 2020-12-21
- 2.0.2 — 2020-03-11
- 2.0.1 — 2019-08-19
- 2.0.0 — 2019-04-09

## README

# dom-util

> 为 `antv` 开发的轻量级工具方法库。


## 安装下载

> tnpm i --save @antv/util

```js
// 所有的 api 是都这么引入，名字不同而已
import { createDom, getStyle } from '@antv/dom-util';

const dom = createDom('<div></div>').appendTo(document.body);
```


## API 文档

> 目前使用到的、且推荐使用的 API 文档，不在文档内的不建议使用。
* createDom(string) `HTMLElement` 创建 dom 对象，支持复杂字符串
* addEventListener(dom, callback) `Object` 添加事件
```js
const handler = addEventListener(dom, function(ev) {

});
handler.remove();
```
* getHeight(dom) `Number`
* getWidth(dom) `Number`
* getOuterHeight(dom) `Number`
* getOuterWidth(dom) `Number`
* getRatio() `Number` 获取屏幕像素比
* getStyle(styleName) 获取样式
* modifyCss(obj) 修改样式

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