Skip to main content

Bug Tracker

Side navigation

#5996 closed enhancement (wontfix)

Opened January 31, 2010 09:39AM UTC

Closed April 16, 2011 09:25PM UTC

Add attribute map support for .clone()

Reported by: Licensed to Gil Owned by:
Priority: minor Milestone:
Component: core Version: 1.4.1
Keywords: needsreview Cc:
Blocked by: Blocking:
Description

Most of the time when I use the .clone() function, I'm cloning an element with an ID, so I have to change the ID with .attr() straight away.

I'd love to see the new $("<div/>", {attrMap}) syntax applied to .clone() as well, so that I could do:

$("#id").clone({id: "newID"});

Patch with unit tests here:

http://github.com/gilmoreorless/jquery/commit/5ad3237c11edf1e69e226f4e9bbefe9a53daa845

Cheers,

Gil

Attachments (0)
Change History (2)

Changed November 20, 2010 02:52PM UTC by dmethvin comment:1

keywords: clone, manipulationneedsreview
status: newopen

Feature creep...marking for review. To me the explicit .clone().attr() is better.

Changed April 16, 2011 09:25PM UTC by john comment:2

milestone: 1.4.2
resolution: → wontfix
status: openclosed

Agreed, explicit .clone().attr() is likely fine in this case.