#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: |
Description
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: console.log(a.__lookupGetter__("test")); // Incorrectly is undefined: console.log(b.__lookupGetter__("test"));
Change History (3)
comment:1 Changed 12 years ago by
Priority: | → undecided |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
comment:2 Changed 9 years ago by
Worth reopening? Getters and setters are much more useful now than 3 years ago.
comment:3 Changed 9 years ago by
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.
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 usesgetOwnPropertyDescriptor
to do this, though.