.set("send", [opts..]) on a form elements duplicates the event attached #2425

Closed
Kadmillos opened this Issue Sep 17, 2012 · 2 comments

Comments

Projects
None yet
2 participants

when i attach an event on a forum elemen for ajax-call like:
form.set("send",{"onError": function {console.log("hello!")}}).send();

the options are overidden so i can later call
form.set("send",{"onError": function {console.log("byebye!")}}).send();

my output is
"hello" on first case

"hello"
"byebye" on the second one

example:
http://jsfiddle.net/Mg4Zq/

Owner

arian commented Sep 24, 2012

.set('send', ...) uses .setOptions, which only adds new event listeners through .addEvent, so it doesn't replace them. So you should just set the options once, so it only adds the events once. Then use .send() multiple times.

@arian arian closed this Sep 24, 2012

the sense of a .set() should be that i need to SET some options, not stack them. even if it occurs only with events or even if i can take as many workaround as i need.

in MooTools 1.2(.x) it works as espected, or was it a bug? O.o'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment