Bug Tracker

Modify

Ticket #5996 (closed enhancement: wontfix)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

Change History

comment:1 Changed 3 years ago by dmethvin

  • Keywords needsreview added; clone, manipulation removed
  • Status changed from new to open

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

comment:2 Changed 3 years ago by john

  • Status changed from open to closed
  • Resolution set to wontfix
  • Milestone 1.4.2 deleted

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.