Skip to main content

Bug Tracker

Side navigation

#5439 closed bug (fixed)

Opened November 01, 2009 05:15PM UTC

Closed November 07, 2009 03:13PM UTC

$.ajax modifies the options object

Reported by: markw65 Owned by:
Priority: major Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

$.ajax modifies the passed in options object. The justification, from the code, is so that it can be checked again later in the test suite.

This seems to be a departure from the normal behavior (and it certainly surprised me that I couldnt pass the same object - with small mods - into multiple ajax calls).

It also seems to be unnecessary, because the extended options object is passed as the this parameter to all the callbacks - so eg beforeSend could be used to examine it.

Here's the code:

ajax: function( s ) {
   // Extend the settings, but re-extend 's' so that it can be
   // checked again later (in the test suite, specifically)
   s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));

I think it the outer extend should be dropped:

   s = jQuery.extend(true, {}, jQuery.ajaxSettings, s);
Attachments (0)
Change History (2)

Changed November 01, 2009 08:11PM UTC by dmethvin comment:1

component: unfilledajax

Changed November 07, 2009 03:13PM UTC by john comment:2

resolution: → fixed
status: newclosed

Good point - I just landed your fix and disabled the test that relied upon it.

http://github.com/jquery/jquery/commit/6a722e251dedd5f01ac0c46e330a368be7bb760b