Modify ↓
Ticket #1830 (closed enhancement: wontfix)
$.copy
| Reported by: | Byron | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.2.2 |
| Component: | core | Version: | 1.2.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
It would be nice to add a function which allows you to copy an object and all its properties, for those cases where you dont want $.extend to overwrite your original object.
$.extend($.copy(myObj), {foo : 'bar'});
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This is better implemented in your own code base. It can be achieved with the following code.
$.copy = function(obj) { return $.extend({}, obj); };