UNPKG

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
## ๐ŸŽ‰ 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