Opened 14 years ago
Closed 13 years ago
#4946 closed bug (fixed)
jQuery.isObject, changeset 6442
Reported by: | balazs.endresz | Owned by: | flesler |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | core | Version: | 1.3.2 |
Keywords: | isObject | Cc: | balazs.endresz |
Blocked by: | Blocking: |
Description
http://dev.jquery.com/changeset/6442
isObject: function( obj ) { return this.constructor.call(obj) === Object; },
I might be missing something but after staring at this for a while, still seems to be quite odd:
-- First, this is a static method, in which using
this
is quite dangerous, as someone might save the function in a local variable, wherethis
will be a reference to the window object
--
this
here basically refers tojQuery
-- so
this.constructor
refers toFunction
-- you call it in another context and it will return
Object
, the Object constructor???
If it's not just a typo I'd be really curious how is this supposed to work :)
Change History (6)
comment:1 Changed 14 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 14 years ago by
comment:3 Changed 14 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:4 Changed 14 years ago by
Cc: | balazs.endresz added |
---|---|
Owner: | set to flesler |
Status: | reopened → new |
Version: | → 1.3.2 |
comment:5 Changed 13 years ago by
There is definitely something wrong with this function. Do we actually need it? It is used only once in the code in jQuery.extend and there is another problem with this code, replacing the test using jQuery.isObject with false doesn't break the code. All tests of jQuery.extend still pass. I suggest fixing jQuery.extend and getting rid of jQuery.isObject if possible.
comment:6 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
This method is gone if favor of the improved isObjectLiteral. http://github.com/jquery/jquery/commit/c2bbcd88335cf6f8df4ac9389ecbae90291377fb
Best to ask this on the jQuery Dev forum.