Skip to main content

Bug Tracker

Side navigation

#8187 closed bug (invalid)

Opened February 06, 2011 09:30AM UTC

Closed February 07, 2011 02:21AM UTC

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

Attachments (0)
Change History (4)

Changed February 06, 2011 01:37PM UTC by jitter comment:1

component: unfiledajax
owner: → 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

Changed February 06, 2011 05:36PM UTC by dmethvin comment:2

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/

Changed February 06, 2011 06:55PM UTC by anonymous comment:3

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

@dmethvin OK

Changed February 07, 2011 02:21AM UTC by jitter comment:4

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.