| 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>BUG: data lost on clone</title> |
|---|
| 6 | <script type="text/javascript" src="jquery-1.3.2.min.js"></script> |
|---|
| 7 | </head> |
|---|
| 8 | <body> |
|---|
| 9 | <p>Click buttons to see attached data:</p> |
|---|
| 10 | <script type="text/javascript"> |
|---|
| 11 | var jq = $("<button>Original</button>") |
|---|
| 12 | .data("blah", 123) |
|---|
| 13 | .appendTo("body") |
|---|
| 14 | .click(function() { alert("blah = " + $(this).data("blah")); }); |
|---|
| 15 | |
|---|
| 16 | jq.clone(true).text("Clone").appendTo("body"); |
|---|
| 17 | </script> |
|---|
| 18 | </body> |
|---|
| 19 | </html> |
|---|