Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10808 closed bug (invalid)

IE8 DontEnum Prevents Proper $.extend Behavior

Reported by: promano@… Owned by: promano@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.7
Keywords: Cc:
Blocked by: Blocking:


IE8's incorrect implementation of the DontEnum property prevents jQuery from seeing overridden native methods and properties in objects while using $.extend.

For example:

+ $.extend(true, {}, { toString:function() { return 'My String!'; } });

Should return 'My String!', but in IE8 since the toString native Object method is not enumerable, the source toString method never gets copied into the target method (thus causing frustrating results).

Refer to this thread about underscore's extend method for more resources and clarification:


With perhaps a bit of tweaking, I fail to see why jQuery can't just enumerate the native methods that use DontEnum and just do a hasOwnProperty check with a little ninja work and whatnot...

Change History (4)

comment:1 Changed 12 years ago by anonymous

That's supposed to be ("" + $.extend(true, {}, { toString:function() { return 'My String!'; } }));

String cast got stripped for some reason.

comment:2 Changed 12 years ago by dmethvin

Owner: set to promano@…
Status: newpending

Is this trying to solve some problem jQuery has with its own internal use of $.extend(), or is it trying to allow others to use $.extend() in situations where it currently cannot be used? Our use-cases tend to be simple and I am not aware of any open issues. If there are any, it would be better to propose this on those open tickets.

comment:3 Changed 12 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 12 years ago by anonymous

Sorry, this ticket is a duplicate of http://bugs.jquery.com/ticket/7467

Note: See TracTickets for help on using tickets.