Skip to main content

Bug Tracker

Side navigation

#6153 closed bug (wontfix)

Opened February 23, 2010 03:18PM UTC

Closed February 26, 2010 05:24PM UTC

Last modified November 24, 2010 12:05AM UTC

$.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:
Blocked by: Blocking:
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.

Attachments (0)
Change History (3)

Changed February 23, 2010 08:09PM UTC by nickspacek comment:1

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.

Changed February 26, 2010 05:24PM UTC by john comment:2

resolution: → wontfix
status: newclosed

Unfortunately there's not really a good solution here as any way we slice it we'll end up having to write a full HTML parser or a deep-element cloner - neither of which is desirable.

Changed November 24, 2010 12:05AM UTC by Dylan Fogarty-MacDonald <dylan.fm@gmail.com> comment:3

I encountered this bug and got around it with: $('html5element').get(0).cloneNode(true)