Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#7458 closed bug (invalid)

slow click event handle?

Reported by: ult_raa@… Owned by: ult_raa@…
Priority: undecided Milestone:
Component: unfiled Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Description

i have modal div with table on it. Clicks on tr removes them (it cant resize automaticly by css, so i have $.modalUpdate() function to resize modal window), and $.modalRemove() binded to modal outside clicks.

$(document).bind('click.modalOutsideClick', function(e){
	if($(e.target).closest('.modal').attr('class') != 'modal')
		$.modalRemove();
});

$('tr').live('click',function(){
	$('tr').remove();
	$.modalUpdate();
}

so, when tr.click event fires, $.modalRemove() fires too. only if tr.remove runs after delay - it will work normal.

$('tr').live('click',function(){
	setTimeout(function() {
		$('tr').remove();
		$.modalUpdate();
	}, 100);
}

Change History (7)

comment:1 Changed 9 years ago by SlexAxton

Owner: set to ult_raa@…
Status: newpending

Can you reduce this and post a test case at jsFiddle.com? That would greatly help us narrow down the issue for you. Thanks.

comment:2 in reply to:  1 Changed 9 years ago by ult_raa@…

Status: pendingnew

Replying to SlexAxton:

Can you reduce this and post a test case at jsFiddle.com? That would greatly help us narrow down the issue for you. Thanks.

http://jsfiddle.net/BtWBA/5/

comment:3 Changed 9 years ago by Rick Waldron

Milestone: 1.5
Resolution: invalid
Status: newclosed

Commenting out "$('.opaque, .modal').remove();" in $.modalRemove() function corrects this issue.

http://jsfiddle.net/rwaldron/BtWBA/7/

The forums are a better place to ask about these things, you'll get faster and more detailed replies there. Be Excellent to youself!

comment:4 Changed 9 years ago by anonymous

You do not quite understand me correctly. Function $.modalRemove() is triggered when it should not do that. Event click.modalOutsideClick must run a function $.modalRemove() when the event target is not .modal child. Please read the example carefully. Click on .modal child must remove this child and do nothing. But it also fires $.modalRemove().

comment:5 Changed 9 years ago by Rick Waldron

Actually, I understand this very well. It's still not a jQuery bug. You have issues with your event binding and delegation.

Take a look around here: "click.modalOutsideClick".

comment:6 Changed 9 years ago by anonymous

I'm very sorry only now found out about event bubbling sorry for any inconvenience

comment:7 Changed 9 years ago by Rick Waldron

It's no problem! Glad we could facilitate a learning experience :D

Note: See TracTickets for help on using tickets.