From 445fdf720ce26b99aadace85b7ec976f90583c3a Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 22 Dec 2010 14:43:17 -0600 Subject: [PATCH] Remove code for ticket #7717 which has been marked WONTFIX to match existing $.data functionality and to prevent infinite loops caused by circular references. --- src/manipulation.js | 2 +- test/unit/manipulation.js | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/manipulation.js b/src/manipulation.js index 203d2ef..3b9aa14 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -382,7 +382,7 @@ function cloneCopyEvent(orig, ret) { } var oldData = jQuery.data( orig[nodeIndex] ), - curData = jQuery.data( this, jQuery.extend(true, {}, oldData) ), + curData = jQuery.data( this, oldData ), events = oldData && oldData.events; if ( events ) { diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 52f76ed..ba57a6f 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -924,16 +924,12 @@ test("clone()", function() { equals( clone.html(), div.html(), "Element contents cloned" ); equals( clone[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" ); - div = jQuery("
").data({ - a: true, b: true, - c: { nesty: ["Block", "Head"] } - }); + div = jQuery("
").data({ a: true }); var div2 = div.clone(true); equals( div2.data("a"), true, "Data cloned." ); - equals( div2.data("b"), true, "Data cloned." ); - var c = div2.data("c"); - c.nesty[0] = "Fish"; - equals( div.data("c").nesty[0], "Block", "Ensure cloned element data is deep copied (Bug #7717)" ); + div2.data("a", false); + equals( div2.data("a"), false, "Ensure cloned element data object was correctly modified" ); + equals( div.data("a"), true, "Ensure cloned element data object is copied, not referenced" ); var form = document.createElement("form"); form.action = "/test/"; -- 1.7.10.4