Bug Tracker

Ticket #2184: clone.html

File clone.html, 1.1 KB (added by kowcik, 14 years ago)

Script will attempt to clone table elements using jQuery methods and native DOM. Results will be alerted for comparison.

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5<title>Thead clone won't work in MSIE</title>
6<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
7</head>
8
9<body>
10
11<div id="container">
12
13<table>
14
15<thead>
16
17<tr>
18
19<td>lorem ipsum</td>
20
21</tr>
22
23</thead>
24
25<tbody><td>dolor color</td></tbody>
26
27<tfoot>
28
29<tr>
30
31<td>and a footer</td>
32
33</tr>
34
35</tfoot>
36
37</table>
38
39</div>
40
41<script type="text/javascript">
42
43var tableElement='td'
44
45//table = ok
46//thead = buggy
47//tfoot = buggy
48//tbody = buggy
49//tr = buggy
50//td = buggy
51
52
53var jQueryclonedTable=$('#container '+tableElement).clone().get(0);
54alert(jQueryclonedTable.innerHTML);
55var DOMclonedTable=document.getElementById('container').getElementsByTagName(tableElement).item(0).cloneNode(true);
56alert(DOMclonedTable.innerHTML);
57
58</script>
59
60</body>
61</html>