tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
40 lines (28 loc) โข 1.91 kB
Markdown
## ๐ TinyHtml updates
A highly refined update for `TinyHtml`, focused on stronger consistency, smarter attribute/property control, and a safer, clearer API. ๐
### โจ Highlights
- ๐ง **New attribute/property mapping system**
โ `TinyHtml.propFix`, `TinyHtml.attrFix`, `getPropName()`, `getAttrName()`
โ Ensures cleaner interaction with DOM properties like `className`, `htmlFor`, etc.
- ๐งฑ **Element list architecture**
โ Internally stores all nodes as arrays
โ Better control and scalability when managing multiple elements
- ๐ **New instance methods**
โ `extract(index)`, `exists(index)`, `get(index)`, `getAll()`
โ More predictable access to elements โ no more ambiguity!
- โ ๏ธ **Breaking change: `get()` now requires an `index`**
โ Due to the new array-based internal model, calling `get()` without arguments will throw
โ Use `get(0)` to access the first element explicitly
- ๐งช **Selector methods now return a single wrapped instance**
โ `queryAll`, `querySelectorAll`, `getByClassName`, `getElementsByClassName`, `getByName`, `getByTagNameNS`, and `getElementsByTagNameNS` now return one `TinyHtml` with all matched elements
โ To behave like before, use `.extract(index)` to unwrap one of them manually
- โ๏ธ **New `createFrom(json)` method**
โ Create fully structured elements using JSON config syntax
โ Ideal for dynamic UI rendering or declarative component creation
- ๐ **Improved input handling**
โ `_getValByType()` now correctly supports `textarea` values
- โ๏ธ **Better error handling and type safety**
โ Clearer validation, safer APIs, and stronger dev confidence
- โ
**Test suite upgraded**
โ Adjusted to respect new API behavior, array-based elements, and refined logic
**Full Changelog**: https://github.com/JasminDreasond/Tiny-Essentials/compare/1.20.0...1.20.1