Skip to content

Commit

Permalink
Resizable: Use .insertAfter() instead of .after() to avoid recursivel…
Browse files Browse the repository at this point in the history
…y destroying. Fixes #8662 - Infinite loop - new to jQuery UI 1.9.0.
  • Loading branch information
scottgonzalez committed Oct 13, 2012
1 parent bd3a348 commit 025266e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions ui/jquery.ui.resizable.js
Expand Up @@ -204,15 +204,14 @@ $.widget("ui.resizable", $.ui.mouse, {
if (this.elementIsWrapper) {
_destroy(this.element);
var wrapper = this.element;
wrapper.after(
this.originalElement.css({
position: wrapper.css('position'),
width: wrapper.outerWidth(),
height: wrapper.outerHeight(),
top: wrapper.css('top'),
left: wrapper.css('left')
})
).remove();
this.originalElement.css({
position: wrapper.css('position'),
width: wrapper.outerWidth(),
height: wrapper.outerHeight(),
top: wrapper.css('top'),
left: wrapper.css('left')
}).insertAfter( wrapper );
wrapper.remove();
}

this.originalElement.css('resize', this.originalResizeStyle);
Expand Down

2 comments on commit 025266e

@dmethvin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just can't repro this when the two elements are connected. I see a bug for .after() with disconnected nodes but it shouldn't come into play with this code. Do you have a test case?

@scottgonzalez
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the ticket for a link to the fiddle. The destroy is being auto-triggered by a call to .remove(), so it's likely that the elements are already disconnected.

Please sign in to comment.