Skip to main content

Bug Tracker

Side navigation

#12076 closed bug (patchwelcome)

Opened July 13, 2012 02:48AM UTC

Closed September 17, 2012 04:00PM UTC

In IE8 and below, time elements in cloned table elements have incorrect tag structures

Reported by: Ian Yang <ian.html@gmail.com> Owned by: rwaldron
Priority: high Milestone: None
Component: manipulation Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

Demonstration on jsFiddle.

In IE8 and below, time elements in cloned table elements have incorrect tag structures like <:time>2012-07-12</:time>.

Attachments (0)
Change History (8)

Changed July 13, 2012 02:56AM UTC by rwaldron comment:1

component: unfiledmanipulation
owner: → rwaldron
priority: undecidedhigh
status: newassigned

Changed July 13, 2012 03:00AM UTC by rwaldron comment:2

priority: highlow
resolution: → invalid
status: assignedclosed

jQuery does not shim HTML5 elements, you MUST include html5shiv

http://code.google.com/p/html5shiv/

Changed July 13, 2012 03:04AM UTC by Ian Yang <ian.html@gmail.com> comment:3

I did include html5shiv.

Changed July 13, 2012 04:03AM UTC by rwaldron comment:4

resolution: invalid
status: closedreopened

Forgive me - it's late, I'm tired and I missed that. Re-opening.

Changed July 13, 2012 04:06AM UTC by rwaldron comment:5

priority: lowhigh
status: reopenedassigned

Changed July 13, 2012 04:11AM UTC by rwaldron comment:6

When I remove the table from the equation, it works fine, but whenever the unknown element is the child of the element being cloned, the whole system breaks down. I'll look at this further tomorow.

http://jsfiddle.net/rwaldron/rxrq9/

Changed July 13, 2012 04:17AM UTC by Ian Yang comment:7

Thanks. Good night.

Changed September 17, 2012 04:00PM UTC by rwaldron comment:8

resolution: → patchwelcome
status: assignedclosed

The only reasonable solution to solving this is to copy innerHTML from the source element into the clone element. Since we only want to do this when a non-native element (ie. HTML5 nodes are not native in oldIE) appears as a child of the element being cloned. To do this, we need to look at all of the children of the element being cloned and check if any have a nodeName that matches the known and supported HTML5 nodeNames. If any of those children have children themselves, then we need to traverse downward and run the same check on all of those children (and of course, so on down through all children). When the nest is only one or two branches deep, with a only a handful of children, this will work just fine. The problem comes when there are very deeply nested DOM trees with large children counts. In those cases, this approach becomes unrealistic.