Bug Tracker

Opened 10 years ago

Closed 10 years ago

#14208 closed bug (notabug)

wrap() function duplicates in IE

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.1
Keywords: Cc:
Blocked by: Blocking:


When i try to unwrap in string the <p> tag and then wrap the same contents with <div> tag it workes with Chrome, but not with IE.


<div id="div1"> One string <p>Two string </p> </div>


if($(this).prop("tagName").toLowerCase() == 'p') $(this).contents().unwrap().wrap('<div></div>');


Result: in Chrome <div id="div1"> One string <div>Two string </div> </div>

in IE <div id="div1"> <div>One string </div><div>Two string </div> </div>

I think this is enough for you to understand the problem, but please contact me if you need more information. Thank you for your attention.

Change History (1)

comment:1 Changed 10 years ago by gibson042

Resolution: notabug
Status: newclosed

Behavior of manipulation methods in general is not guaranteed for non-element nodes like the text node in your example. Note that both .wrap and .unwrap are clear to specify that they operate upon elements.

Note: See TracTickets for help on using tickets.