Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure that the previous element is removed from the page before t…
…he next is inserted, in replaceWith. Using a variation of the patch by snaury. Fixes #2697.
- Loading branch information
Showing
2 changed files
with
19 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2a6de9a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just gone trough the bug report, and also the dev group's archives. Since there is no way I can post a comment to either, I'll do it here. This patch does not fix all the cases. Im my case, I do replaceWith once, and it works. The second time I do it, it just appends new content right after the old one. And on all subsequent occasions. For example, let's say I have a
with ID of 'foo'
On first
$("#foo").replaceWith('<p id='foo'></p>');
I get the same thing:Next time I run
$("#foo").replaceWith('<p id='foo'></p>');
I have:And so on.
2a6de9a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to have been fixed: 51283d9
2a6de9a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that commit released? I'm seeing the above error in currently released version of jQuery.
2a6de9a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@foxbunny: I'll need you to provide a better test case then (one that works within the context of the jQuery test suite - or one that runs on jsfiddle, or similar, because I'm unable to reproduce it.
2a6de9a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okeydokey. As soon as I have some time, I'll take a look at the test case and see what I can do.