Bug Tracker

Opened 7 years ago

Closed 6 years ago

#12076 closed bug (patchwelcome)

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

Reported by: Ian Yang <ian.html@…> Owned by: Rick Waldron
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>.

Change History (8)

comment:1 Changed 7 years ago by Rick Waldron

Component: unfiledmanipulation
Owner: set to Rick Waldron
Priority: undecidedhigh
Status: newassigned

comment:2 Changed 7 years ago by Rick Waldron

Priority: highlow
Resolution: invalid
Status: assignedclosed

jQuery does not shim HTML5 elements, you MUST include html5shiv

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

comment:3 Changed 7 years ago by Ian Yang <ian.html@…>

I did include html5shiv.

comment:4 Changed 7 years ago by Rick Waldron

Resolution: invalid
Status: closedreopened

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

comment:5 Changed 7 years ago by Rick Waldron

Priority: lowhigh
Status: reopenedassigned

comment:6 Changed 7 years ago by Rick Waldron

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/

comment:7 Changed 7 years ago by Ian Yang

Thanks. Good night.

comment:8 Changed 6 years ago by Rick Waldron

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.

Note: See TracTickets for help on using tickets.