@zero-dependency/dom
TypeScript icon, indicating that this package has built-in type declarations

1.8.4 • Public • Published

@zero-dependency/dom

npm version npm bundle size (scoped) npm license

Installation

npm install @zero-dependency/dom
yarn add @zero-dependency/dom
pnpm add @zero-dependency/dom

Usage

import { el, observeElement, waitElement } from '@zero-dependency/dom'

// createElement
const element = el('div', { class: 'foo' }, 'Hello World')
document.body.appendChild(element)

// observeElement
observeElement(element, (mutation, observer) => {
  console.log(mutation.target.textContent) // 'hello world'
  observer.disconnect()
})

element.textContent = element.textContent.toLowerCase() // 'hello world'

// waitElement
const el = await waitElement('div.card')
console.log(el) // <div class="card">...</div>

Package Sidebar

Install

npm i @zero-dependency/dom

Weekly Downloads

10

Version

1.8.4

License

MIT

Unpacked Size

25.2 kB

Total Files

12

Last publish

Collaborators

  • crashmax