Bug Tracker

Opened 10 years ago

Closed 10 years ago

#10481 closed bug (invalid)

recursion with resize events

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: None
Component: event Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:

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 (4)

comment:1 Changed 10 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 10 years ago by dmethvin

Owner: set to [email protected]
Status: newpending

comment:3 in reply to:  1 Changed 10 years ago by [email protected]

Status: pendingnew

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 10 years ago by timmywil

Component: unfiledevent
Priority: undecidedlow
Resolution: invalid
Status: newclosed

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

Note: See TracTickets for help on using tickets.