Side navigation
#4946 closed bug (fixed)
Opened July 22, 2009 08:08PM UTC
Closed November 11, 2009 06:39PM UTC
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, where this
will be a reference to the window object
-- this
here basically refers to jQuery
-- so this.constructor
refers to Function
-- 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 :)
Attachments (0)
Change History (6)
Changed July 23, 2009 01:13AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Changed July 23, 2009 08:42AM UTC by comment:2
Changed July 26, 2009 08:54PM UTC by comment:3
resolution: | invalid |
---|---|
status: | closed → reopened |
Changed September 14, 2009 06:46PM UTC by comment:4
cc: | → balazs.endresz |
---|---|
owner: | → flesler |
status: | reopened → new |
version: | → 1.3.2 |
Changed November 06, 2009 08:50PM UTC by comment:5
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.
Changed November 11, 2009 06:39PM UTC by comment:6
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.