Ticket #9507 (closed bug: wontfix)
jQuery.isPlainObject( NodeList ) === true in IE 6, 7, 8
| Reported by: | rkatic | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | core | Version: | 1.6.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Change History
comment:2 Changed 2 years ago by dmethvin
- Status changed from new to open
Not sure if this needs fixing, but see the discussion in the pull request.
comment:3 Changed 2 years ago by rwaldron
@dmethvin
http://bugs.jquery.com/ticket/7780#comment:5
We discussed in the -dev channel not attempting to support every single host object.
comment:4 Changed 2 years ago by rkatic
If a person uses isPlainObject, then it is likely that such person will also work more directly with the DOM (plugins). So I think it is important to support at least every DOM instance (no window.location or window.alert), and I think my solution would fix that.
comment:6 Changed 2 years ago by rwaldron
- Priority changed from undecided to low
- Component changed from unfiled to core
comment:7 Changed 2 years ago by ajpiano
- Status changed from open to closed
- Resolution set to wontfix
The consensus we've reached at this stime is that we will not be attempting to detect host objects in $.isPlainObject and $.map. While edge cases like this do come up, detection is unreliable and comes at a relatively high cognitive cost without clear benefit to the vast majority of jQuery users. If in the future, it becomes apparent that this issue is something that is a pain point to a larger contingent of developers, we can revisit the issue.
comment:8 Changed 2 years ago by rkatic
The consensus we've reached at this stime is that we will not be attempting to detect host objects in $.isPlainObject and $.map.
But it already does (window, node), and with my patch it improves the detection of those objects, plus detects other DOM instances like NodeList-s. I am not extending isPlainObject to support all inputs (like window.location...), I am just making it more consistent...
While edge cases like this do come up, detection is unreliable and comes at a relatively high cognitive cost without clear benefit to the vast majority of jQuery users.
Are you saying that my patch is unreliable? Have you any argument, or it is not clear how it works? If it could help, I am disposed to explain it.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Patch: https://github.com/jquery/jquery/pull/402