in partnership with mediatemple

Ticket #996 (closed enhancement: wontfix)

Opened 3 weeks ago

Last modified 2 weeks ago

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

Changed 2 weeks ago by JanK

  • status changed from new to closed
  • resolution set to wontfix

since there is no event propagation for objects any kind of stopPropagation makes no sense, events on the same 'level' cant be stopped (and also cant for element events)

Note: See TracTickets for help on using tickets.