308 | | container2 = document.createElement("div"); |
309 | | container.appendChild(clone); |
310 | | container2.innerHTML = container.innerHTML; |
311 | | return container2.firstChild; |
| 308 | container2 = document.createElement("div"), |
| 309 | n = this.nodeName.toLowerCase(); |
| 310 | |
| 311 | if ( n=="tr"||n=="tbody"||n=="thead"||n=="tfoot"||n=="td" ) { |
| 312 | var t = document.createElement("table"); |
| 313 | if ( n == "td" ) { |
| 314 | var tr = document.createElement("tr"); |
| 315 | tr.appendChild(clone); |
| 316 | t.appendChild(tr); |
| 317 | } else |
| 318 | t.appendChild(clone); |
| 319 | container.appendChild(t); |
| 320 | container2.innerHTML = container.innerHTML; |
| 321 | with ( container2.firstChild ) switch ( n ) { |
| 322 | case "tr": |
| 323 | return firstChild.firstChild; |
| 324 | case "td": |
| 325 | return firstChild.firstChild.firstChild; |
| 326 | default: |
| 327 | return firstChild; |
| 328 | } |
| 329 | } else { |
| 330 | container.appendChild(clone); |
| 331 | container2.innerHTML = container.innerHTML; |
| 332 | return container2.firstChild; |
| 333 | } |