Opened 13 years ago
Closed 12 years ago
#5806 closed bug (fixed)
jQuery leaves textnodes in replaceWith
Reported by: | Sebmaster | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.4.1 |
Component: | core | Version: | 1.4 |
Keywords: | textnodes replacewith | Cc: | |
Blocked by: | Blocking: |
Description
I think the title describes the problem pretty good. If i call replaceWith on a text node (in this case, don't have the time to test much further), replaceWith only replaces with content inside of HTML-tags.
It worked for me in jQuery 1.4a1 and jQuery 1.3.2. Might be related with #5483?
Attachments (2)
Change History (6)
Changed 13 years ago by
Attachment: | testcase.htm added |
---|
comment:1 Changed 13 years ago by
I'm seeing this bug also, here's a test case comparing 1.3.2 against 1.4:
http://jsbin.leftlogic-staging.com/icigi/2/edit
You can also see it in the wild if as this technique of replacing textNodes is being used in Snap Bird:
http://snapbird.org/rem/favs/git
The text shouldn't read just "git" it should be the full tweet with git in bold.
comment:2 Changed 13 years ago by
On further investigation, since replaceWith uses detach to "clean" the string, I can verify that there's a bug in detach:
http://jsbin.leftlogic-staging.com/efeci/edit
The alert should show 'hello <i>world</i>', but only shows 'world'
Changed 13 years ago by
Attachment: | jquery-test.htm added |
---|
This seems to also occur when I use the jQuery() function itself.
comment:4 Changed 12 years ago by
Keywords: | textnodes replacewith added |
---|---|
Priority: | major → low |
Resolution: | → fixed |
Status: | new → closed |
As Sebmaster states, this appears to have been fixed in jQuery 1.4.2 and currently works through 1.4.3 and 1.4.4 RC2 http://jsfiddle.net/addyosmani/LReun/. Closing as fixed unless there are any comments to the contrary.
testcase showed the wrong situation