Side navigation
#10808 closed bug (invalid)
Opened November 16, 2011 11:51PM UTC
Closed December 01, 2011 07:49AM UTC
Last modified December 01, 2011 04:07PM UTC
IE8 DontEnum Prevents Proper $.extend Behavior
Reported by: | promano@urbandaddy.com | Owned by: | promano@urbandaddy.com |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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:
https://github.com/documentcloud/underscore/issues/60
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...
Attachments (0)
Change History (4)
Changed November 16, 2011 11:54PM UTC by comment:1
Changed November 16, 2011 11:56PM UTC by comment:2
owner: | → promano@urbandaddy.com |
---|---|
status: | new → pending |
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.
Changed December 01, 2011 07:49AM UTC by comment:3
resolution: | → invalid |
---|---|
status: | pending → closed |
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!
Changed December 01, 2011 04:07PM UTC by comment:4
Sorry, this ticket is a duplicate of http://bugs.jquery.com/ticket/7467
That's supposed to be ("" + $.extend(true, {}, { toString:function() { return 'My String!'; } }));
String cast got stripped for some reason.