Bug Tracker

Modify

Ticket #10481 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

recursion with resize events

Reported by: office@… Owned by: office@…
Priority: low Milestone: None
Component: event Version: 1.6.4
Keywords: Cc:
Blocking: Blocked by:

Description

The code below produces a recursion, unless I change the namespace in function reposition() to a different than for the window-resize-event. This behavior was not in jquery v1.5.1 f.e. (not tested others) From my understanding this is a bug.

$(window).unbind("resize.divlayout").bind("resize.divlayout", function() {

console.log('window resize'); reposition();

}).trigger("resize.divlayout");

function reposition() { $("#website_body").unbind('resize.divlayout').bind('resize.divlayout', function() {

console.log('website_body resize'); if( $("#website_page").css("position") != 'absolute' ) {

$("#website_page").css("padding-top", $("#website_body").height() / 2 - $("#website_page").height() /2 + "px");

}else {

$("#website_page").css("top", $("#website_body").height() / 2 - $("#website_page").height() /2 + "px");

} }).trigger('resize.divlayout');

}

<div id="website_body">

<div id="website_page">&nbsp;</div>

</div>

Change History

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

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket! Also indicate the browsers where the problem occurs.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate:  http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:2 Changed 3 years ago by dmethvin

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

comment:3 in reply to: ↑ 1 Changed 3 years ago by office@…

  • Status changed from pending to new

Thanks for your fast response. Here is the jsfiddle-fork test case:  http://jsfiddle.net/E8Dtg/1/

in production FF 7.0.1 crashes FF 3.6 firebug msg: to much recursion IE 8.0 out of memory other browsers not tested.

comment:4 Changed 3 years ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to event

An infinite loop was created...the crash is a good thing.

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.