Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 9 years ago

#6145 closed bug (wontfix)

Extend does not copy property getters

Reported by: arobinson Owned by:
Priority: undecided Milestone: 1.4.2
Component: core Version: 1.4.1
Keywords: extend Cc:
Blocked by: Blocking:


jQuery.extend copies property getter return values, not their code.

To reproduce:

var a = { get test() { return "hi"; }};
var b = $.extend({}, a);
// Correctly prints out the function:
// Incorrectly is undefined:

Change History (3)

comment:1 Changed 12 years ago by snover

Priority: undecided
Resolution: wontfix
Status: newclosed

Not all browsers supported by jQuery support ES5. Additionally, I doubt so many people are using getter/setters at this point that it is worth adding to core. Feel free to make your own $.extend that uses getOwnPropertyDescriptor to do this, though.

comment:2 Changed 9 years ago by anonymous

Worth reopening? Getters and setters are much more useful now than 3 years ago.

comment:3 Changed 9 years ago by dmethvin

This is not in scope for the applications of $.extend. Create your own or use libraries like underscore/lodash.

Note: See TracTickets for help on using tickets.