Opened 14 years ago
Closed 14 years ago
#5439 closed bug (fixed)
$.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);
Change History (2)
comment:1 Changed 14 years ago by
Component: | unfilled → ajax |
---|
comment:2 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Good point - I just landed your fix and disabled the test that relied upon it. http://github.com/jquery/jquery/commit/6a722e251dedd5f01ac0c46e330a368be7bb760b