Modify ↓
Ticket #6153 (closed bug: wontfix)
$.clone() does not clone children of HTML5 elements in IE
| Reported by: | nickspacek | Owned by: | |
|---|---|---|---|
| Priority: | Milestone: | 1.4.2 | |
| Component: | manipulation | Version: | 1.4.1 |
| Keywords: | clone, ie | Cc: | |
| Blocking: | Blocked by: |
Description
Seems like a strange bug, but since IE doesn't really support HTML5 elements maybe not too surprising.
Sample is here: http://nickspacek.github.com/bug.html
The element itself is cloned, but not the children.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

After doing some research, I have discovered (as was probably already known) that this is due to the lack of support in IE for HTML5, and jQuery's use of innerHTML to clone objects.
After reading that MooTools worked around the same issue as jQuery in a different way, I tried using that library to clone HTML5 elements. It almost worked, except that the tags come out prefixed with a ':'.
I'm not sure if there is a way around that, but it could be a possible solution. The tagName is reported without the ':', which I'm assuming IE is prepending because of XML namespace stuff.