Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#9507 closed bug (wontfix)

jQuery.isPlainObject( NodeList ) === true in IE 6, 7, 8

Reported by: Robert Katić Owned by:
Priority: low Milestone: 1.next
Component: core Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:

Description

Change History (8)

comment:2 Changed 8 years ago by dmethvin

Status: newopen

Not sure if this needs fixing, but see the discussion in the pull request.

comment:3 Changed 8 years ago by Rick Waldron

@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 8 years ago by Robert Katić

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:5 Changed 8 years ago by Rick Waldron

Docs have been upated, see #7780

comment:6 Changed 8 years ago by Rick Waldron

Component: unfiledcore
Priority: undecidedlow

comment:7 Changed 8 years ago by ajpiano

Resolution: wontfix
Status: openclosed

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.

Last edited 8 years ago by ajpiano (previous) (diff)

comment:8 Changed 8 years ago by Robert Katić

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.

Note: See TracTickets for help on using tickets.