el-tool
v1.0.7
Published
Shorthand syntax for Element functions
Downloads
2
Readme
EL-tool
El-tool is a tersifier for creating DOM nodes and adding event listeners. It is not a library, it just shortens some rather verbose native code.
QRE (quick reference example)
The following are the same:
Vanilla.js (730 char)
El.ts (331 char)
Benefits
- Currently the fastest possible way to render an interactive DOM (see benchmarks section below)
- Nested syntax reflects DOM nesting
- < 250 lines of code (with comments, unminified)
- Significantly reduces redundancy in code
- Super easy DOM node reference catching (no queries)
Helper Functions
byId(id)
: tersifies as document.getElementById(id)
classSplice(element: HTMLElement, removeClasses: string | string[], addClasses: string | string[])
: tersifies element.classList.add()
and element.classList.remove()
removeChildren(parent: HTMLElement)
: removes all children