Skip to content
Permalink
Browse files
Resizable: Use .insertAfter() instead of .after() to avoid recursivel…
…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 025266e00270d155f45550b6838ddd6f4a44470b
Showing 1 changed file with 8 additions and 9 deletions.
@@ -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);

2 comments on commit 025266e

@dmethvin
Copy link
Member

@dmethvin dmethvin commented on 025266e Oct 14, 2012

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

@scottgonzalez scottgonzalez commented on 025266e Oct 14, 2012

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.