Modify ↓
Ticket #12199 (closed bug: fixed)
$.isPlainObject false positive in IE < 9
| Reported by: | jdalton | Owned by: | bjohn465 |
|---|---|---|---|
| Priority: | high | Milestone: | 1.10 |
| Component: | core | Version: | 1.8rc1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
IE < 9 iterates over inherited properties before own properties which breaks the assumption in isPlainObject.
View the simple test case here (in IE < 9 and some other modern browser): http://jsbin.com/ilulip
The last value logged to the page should be false but in IE < 9 it's true.
Change History
comment:2 Changed 10 months ago by rwaldron
- Owner set to rwaldron
- Priority changed from undecided to high
- Status changed from new to assigned
- Component changed from unfiled to core
Thanks for the heads up—I'll have a patch for you to review today
comment:5 Changed 3 months ago by bjohn465
I put together a potential fix: https://github.com/jquery/jquery/pull/1196
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.

Here is Lo-Dash's isPlainObject implementation that avoids this issue: https://github.com/bestiejs/lodash/blob/7520066fc916e205ef84cb97fbfe630d7c154158/lodash.js#L720-757