Bug Tracker

Opened 10 years ago

Closed 10 years ago

#6268 closed bug (wontfix)

clone() doesn't copy "own properties" of html elements in firefox and safari

Reported by: nikravi Owned by:
Priority: Milestone: 1.4.3
Component: manipulation Version: 1.4.2
Keywords: clone ownProperty Cc:
Blocked by: Blocking:

Description

When cloning an html element, and setting to the "dom" object a property

var div = $("<div />");

div.get(0).aProperty = "aValue";

it is not copied to it's clone.

$("#result").text(div.clone().get(0).aProperty
"undefined");

The bug appears in firefox and safari. In IE6-8 clone() works as expected.

Change History (1)

comment:1 Changed 10 years ago by john

Resolution: wontfix
Status: newclosed

That's correct - and not something that we guarantee. If you wish to copy values like that in a clone I recommend using jQuery's .data() API (which will copy the data values in the clone). http://api.jquery.com/data/

Note: See TracTickets for help on using tickets.