Bug Tracker

Opened 8 years ago

Closed 8 years ago

#8187 closed bug (invalid)

AJAX Context bug

Reported by: Stefan Owned by: Stefan
Priority: low Milestone: 1.next
Component: ajax Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

Description

If the context is '0' then the returned context is an object

Change History (4)

comment:1 Changed 8 years ago by jitter

Component: unfiledajax
Owner: set to Stefan
Priority: undecidedlow
Status: newpending

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

Please submit a reduced test case, which reproduces the issue you are experiencing, on http://jsfiddle.net. So that we can investigate this issue further. Also make sure to read the link given below, in order to provide a most useful bug report.


How to report bugs

comment:2 Changed 8 years ago by dmethvin

It is part of the ECMA standard that the this passed during a function call or apply is converted to an object if it is not one. Simple demo, not using jQuery:

http://jsfiddle.net/dmethvin/hSqb4/

comment:3 Changed 8 years ago by anonymous

http://jsfiddle.net/stefanpetre/GegCX/4/ first AJAX call has 0 as context. The second call has 1 as context.

@dmethvin OK

comment:4 Changed 8 years ago by jitter

Resolution: invalid
Status: pendingclosed

This isn't a bug.

The jQuery.ajax() documentation says:

context: This object will be made the context of all Ajax-related callbacks.

So passing anything other then an object / DOM element is an invalid usage of this option.

If this worked differently in earlier versions of jQuery it was purely coincidental. The behavior for unspecified/invalid usage of options is subject to change or might even be throwing errors in future versions.

Note: See TracTickets for help on using tickets.