Skip to main content

Bug Tracker

Side navigation

#6261 closed bug (fixed)

Opened March 11, 2010 02:34AM UTC

Closed March 31, 2011 03:41PM UTC

clone(false) inserts empty nodes in IE

Reported by: Eddie Owned by:
Priority: low Milestone:
Component: manipulation Version: 1.4.2
Keywords: clone true false ie insert inserts blank Cc:
Blocked by: Blocking:
Description

$('#myElement').clone(false) inserts empty nodes in IE while $('#myElement').clone(true) doesn't.

An example:


<ul id="myElement">
	<li><span>Test</span><div> </div></li>
</ul>

$('#myElement').clone(true) will end up in:

<ul id="myElement">
	<li><span>Test</span><div> </div></li>
</ul>

$('#myElement').clone(false) will end up in:

<ul id="myElement">
	<li><span>Test</span> <div> </div></li>
</ul>

Mark the space directly after the closing </span>. This will mess up certain designs in IE 8 (and maybe others). See attached Screenshots.

Attachments (3)
  • clone_false.png (2.5 KB) - added by Eddie March 11, 2010 02:39AM UTC.

    clone(false) in IE 8

  • clone_true.png (2.5 KB) - added by Eddie March 11, 2010 02:38AM UTC.

    clone(true) in IE 8

  • test-6261.html (0.4 KB) - added by dmethvin September 27, 2010 03:25AM UTC.
Change History (4)

Changed June 15, 2010 12:32AM UTC by dmethvin comment:1

component: unfiledmanipulation

Changed September 27, 2010 12:30AM UTC by dmethvin comment:2

priority: → undecided

I get the same behavior with an extraneous text node, regardless of whether

.clone()
is called with true or false. In the clone code you can see that this.outerHTML is returning markup with the extra spaces. This probably isn't fixable unless we find a solution that doesn't involve outerHTML.

Changed October 23, 2010 09:27PM UTC by SlexAxton comment:3

milestone: 1.4.31.5
priority: undecidedlow
status: newopen

Changed March 31, 2011 03:41PM UTC by danheberden comment:4

_comment0: No longer an issue in 1.51301586113660514
resolution: → fixed
status: openclosed

No longer an issue in 1.5 - http://jsfiddle.net/danheberden/kaa8D/