Skip to content

v2.2.0 - The Performance & Event Upgrade 🚀

Choose a tag to compare

@k37z3r k37z3r released this 19 Apr 11:23
· 21 commits to main since this release
82886ea

This major update brings a massive overhaul to the event system, introducing full event delegation, custom data passing, and new mobile touch gestures. Under the hood, the core iteration engine has been completely rewritten to maximize performance and reduce CPU overhead.

🚀 New Features

  • Advanced Event System: .on() and .off() now fully support Event Delegation (e.g., $('ul').on('click', 'li', handler)) and passing custom event data to the handler.
  • One-Time Events: Added the .once() method to execute a handler at most once per element and event type.
  • Programmatic Triggers: Added .trigger(eventName, data) to manually dispatch native or custom events.
  • Touch Gestures: Built-in mobile support with .swipeLeft(), .swipeRight(), .swipeUp(), and .swipeDown() helpers.
  • Mouse Helpers: Added .hover(handlerIn, handlerOut) for quick and easy mouseenter/mouseleave chaining.
  • Global Utilities: $.each(), $.throttle, and $.debounce are now globally exposed on the $ object for easy access.

⚡ Performance

  • High-Performance Iteration: Replaced native .forEach with a custom, breakable $.each() loop across the entire framework. This significantly reduces CPU overhead during DOM, CSS, and Event manipulations and allows for early loop termination.

🛡️ Bug Fixes & Architecture

  • SSR Safety: Fixed a critical bug where string selectors would fall back to the global document instead of the passed isolated context. Node.js and Server-Side environments are now completely safe.
  • Event Delegation Fix: Fixed a potential TypeError crash when a user clicked on a pure TextNode (which lacks the .closest() method) during event delegation.
  • Typings: Fixed a TypeScript signature mismatch for .prop() to correctly handle getter and setter overloads.
  • Leaner Installation: Moved jsdom and tslib from standard dependencies to peerDependencies / devDependencies. This drastically reduces the installation size for browser-only users via npm.