Skip to main content

Bug Tracker

Side navigation

#14208 closed bug (notabug)

Opened July 31, 2013 12:23PM UTC

Closed July 31, 2013 03:20PM UTC

wrap() function duplicates in IE

Reported by: nicekode@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.1
Keywords: Cc:
Blocked by: Blocking:
Description

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.

Example:

<div id="div1">

One string <p>Two string </p>

</div>

$('#div1').find("*").each(function(){

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.

Attachments (0)
Change History (1)

Changed July 31, 2013 03:20PM UTC by gibson042 comment:1

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''.