Side navigation
#7780 closed bug (worksforme)
Opened December 14, 2010 08:24PM UTC
Closed December 24, 2010 03:10PM UTC
Last modified June 05, 2011 07:05PM UTC
$.isPlainObject inconsistent
Reported by: | rwaldron | Owned by: | rwaldron |
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | core | Version: | 1.4.4 |
Keywords: | neededdocs | Cc: | |
Blocked by: | Blocking: |
Description
As documented in this fiddle, $.isPlainObject() is evaluating inconsistently across browsers.
Attachments (0)
Change History (8)
Changed December 14, 2010 08:26PM UTC by comment:1
component: | unfiled → core |
---|---|
owner: | → rwaldron |
priority: | undecided → high |
status: | new → assigned |
Changed December 14, 2010 08:44PM UTC by comment:2
Changed December 14, 2010 09:47PM UTC by comment:3
keywords: | → needsdocs |
---|---|
resolution: | → wontfix |
status: | assigned → closed |
Changed December 14, 2010 10:07PM UTC by comment:4
resolution: | wontfix |
---|---|
status: | closed → reopened |
Changed December 24, 2010 02:34AM UTC by comment:5
I thought we accepted that host objects might break this way, kind of like how we don't support $.isFunction(window.alert)
. Or is the needsdocs here just to say we need to document that fact?
Changed December 24, 2010 03:10PM UTC by comment:6
resolution: | → worksforme |
---|---|
status: | reopened → closed |
Dave, yes - there are too many host objects that have too many inconsistencies for the library to robustly feature detect (without adding garbage regular expressions) - the needsdocs tag is to document this.
Changed April 20, 2011 07:43PM UTC by comment:7
isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } // Not own constructor property must be Object if ( obj.constructor && !hasOwn.call(obj, "constructor") && !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) { if(!hasOwn.call( obj, key )){ return false; } } return key === undefined; }
Changed June 05, 2011 07:05PM UTC by comment:8
keywords: | needsdocs → neededdocs |
---|
Documentation updated: http://api.jquery.com/jQuery.isPlainObject/
Initially reported by jaubourg here: #7743