Opened 13 years ago
Closed 12 years ago
#6261 closed bug (fixed)
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)
Change History (7)
Changed 13 years ago by
Attachment: | clone_true.png added |
---|
comment:1 Changed 13 years ago by
Component: | unfiled → manipulation |
---|
comment:2 Changed 12 years ago by
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 12 years ago by
Attachment: | test-6261.html added |
---|
comment:3 Changed 12 years ago by
Milestone: | 1.4.3 → 1.5 |
---|---|
Priority: | undecided → low |
Status: | new → open |
comment:4 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
No longer an issue in 1.5 - http://jsfiddle.net/danheberden/kaa8D/
clone(true) in IE 8