Comments (1)
Too many hooks and strategy differences to be worth replacing jQuery internals. There's a lot of special handling features. And instead of using DOM events, jQuery works hard to mimic their behavior (event props, bubbling paths, etc), then checks if the target has a method with the same name as the event type and calls it (unless the target is the window) to cause a native event/behavior. This makes sense in their context, but not for Eventi. Eventi is meant to use the DOM, not mimic it. And it is meant to fire/handle events, definitely not to cause DOM behaviors directly.
Further, their namespace system does the reverse of Eventi's listener filtering. $(el).on('type',...)
does not handle type
events fired with namespaces, giving trigger()
more control than on()
. This seems counter-intuitive to me, particularly because listener code tends to be more complex than triggering code. Thus, Eventi.on(el, 'type',...)
handles all type
events (regardless of category/tag/etc), to give on()
more control than fire()
. Adapting Eventi to support jQuery-style namespacing is not going to happen.
So, the state of things currently is this: jQuery can already listen for Eventi-fired DOM events (with all Eventi properties, but not Eventi listening/handling features), because we dispatch via DOM event system, instead of just mimicking it. Eventi can already hear jQuery-triggered native events (e.g. dispatched via elem.click()
and without the few jQuery properties or features). The only complete misfire is that $(el).trigger('thisIsCustom')
is inaccessible outside of jQuery handling.
The plan now is just to overwrite jQuery.trigger
to simultaneously dispatch a CustomEvent on the element in the cases where there is no elem[type]
function. This would at least allow DOM or Eventi listeners to capture all jQuery-triggered custom events, even including data arguments.
from eventi.
Related Issues (8)
- Allow reference/definition strings as handler functions in JavaScript
- Throttle/debounce support
- Support type-less listener registration.
- Share features across multiple definitions via grouped syntax
- Capo integration
- Create DOM declare-listeners via JavaScript, not just [data-]eventi="..." attributes
- Allow multiple definitions when doing batch listener registration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eventi.