Skip to main content

Bug Tracker

Side navigation

#6268 closed bug (wontfix)

Opened March 11, 2010 03:28PM UTC

Closed March 11, 2010 03:38PM UTC

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.

Attachments (0)
Change History (1)

Changed March 11, 2010 03:38PM UTC by john comment:1

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/