Skip to main content

Bug Tracker

Side navigation

#10481 closed bug (invalid)

Opened October 12, 2011 11:28AM UTC

Closed October 19, 2011 06:14PM UTC

recursion with resize events

Reported by: office@kohout.at Owned by: office@kohout.at
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"> </div>

</div>

Attachments (0)
Change History (4)

Changed October 12, 2011 01:21PM UTC by dmethvin comment:1

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.

Changed October 12, 2011 01:21PM UTC by dmethvin comment:2

owner: → office@kohout.at
status: newpending

Changed October 12, 2011 04:56PM UTC by office@kohout.at comment:3

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.

Changed October 19, 2011 06:14PM UTC by timmywil comment:4

component: unfiledevent
priority: undecidedlow
resolution: → invalid
status: newclosed

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