Bug Tracker

Modify

Ticket #7458 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

slow click event handle?

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

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

comment:1 follow-up: ↓ 2 Changed 3 years ago by SlexAxton

  • Owner set to ult_raa@…
  • Status changed from new to pending

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 3 years ago by ult_raa@…

  • Status changed from pending to new

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 3 years ago by rwaldron

  • Status changed from new to closed
  • Resolution set to invalid
  • Milestone 1.5 deleted

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 3 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 3 years ago by rwaldron

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 3 years ago by anonymous

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

comment:7 Changed 3 years ago by rwaldron

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.