Closed spencermountain closed 10 years ago
Good catch. Definitely something is happening there, so I'll have to look into it. It appears if you reverse the order it works correctly:
$("body").oj ->
div 'hello',
click: ->
alert('this runs on click')
insert: ->
alert('this runs on insert')
alert('this runs on compile')
Ah, interesting it is definitely calling the last defined event at a strange time. For example this one is calling mouseout when inserting:
Button 'Insert', click: ->
$("body").ojAppend ->
div 'hello',
insert: ->
alert('this runs on insert')
click: ->
alert('this runs on click')
mouseout: ->
alert('this runs on out')
alert('this runs on compile')
Thanks for finding this =). This is fixed in 0.3.3. Let me know if it works for you!
(If you are interested: the issue was the classic function bind issue where the last variable in the loop was captured instead of the specific insert
one).
hey evan, found something curious happening when there's an insert, followed by a click listener - the click listener triggers somehow during the insert. if you change either one to another listener, or even change the order of the listeners, it works as expected. cheers