Opened 11 years ago
Closed 11 years ago
#10481 closed bug (invalid)
recursion with resize events
Reported by: | Owned by: | ||
---|---|---|---|
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>
Change History (4)
comment:1 follow-up: 3 Changed 11 years ago by
comment:2 Changed 11 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:3 Changed 11 years ago by
Status: | pending → 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 11 years ago by
Component: | unfiled → event |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
An infinite loop was created...the crash is a good thing.
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.