Ticket #996 (closed enhancement: wontfix)
Class fireEvent modification
| Reported by: | nogray | Owned by: | |
|---|---|---|---|
| Type: | enhancement | Priority: | trivial |
| Milestone: | Mootools version 1.2 | Component: | Core |
| Keywords: | Cc: |
Description
Hi,
I am building a UI and I need to create custom events for my objects. That was easy except I couldn't run a stopEvent() on custom events. I modified the fireEvent function so if an event returns false, the event propagation will stop.
Here is the code sample, hope this will help in the future.
Events.implement({
fireEvent: function(type, args, delay){
if (!this.$events || !this.$events[type]) return this;
var cont = true;
for (var i=this.$events[type].length - 1; i >= 0; i--){
cont = this.$events[type][i].create({'bind': this, 'delay': delay, 'arguments': args})();
if (!$defined(cont))
cont = true;
if (!cont)
break;
}
return this;
}
});
Change History
Note: See
TracTickets for help on using
tickets.