@huangjs888/lightdom
TypeScript icon, indicating that this package has built-in type declarations

2.1.5 • Public • Published

lightdom

一些dom操作

安装使用

npm install @huangjs888/lightdom --save

使用方法

import { createElement, setStyle, addClass, hasClass, removeClass } from '@huangjs888/lightdom';

const dom = createElement(
  {
    className: ['test', 'test2'],
    style: { width: 100, marginTop: 20 },
  },
  createElement('span', { style: { color: 'red' }, dataName: 'span element' }, 'Hello World'),
  document.body,
);
setStyle(addClass(removeClass(dom, 'test2'), 'test3'), { height: 100, marginLeft: 20 });
console.log(hasClass(dom, 'test2'));
console.log(hasClass(dom, 'test3'));

Package Sidebar

Install

npm i @huangjs888/lightdom

Weekly Downloads

4

Version

2.1.5

License

MIT

Unpacked Size

165 kB

Total Files

9

Last publish

Collaborators

  • huangjs888