Side navigation
#4498 closed feature (fixed)
Opened April 06, 2009 04:32PM UTC
Closed April 10, 2009 11:30PM UTC
unexpected redirect in jQuery.extend function
Reported by: | oluckyman | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | core | Version: | 1.3.2 |
Keywords: | extend | Cc: | |
Blocked by: | Blocking: |
Description
i have post request:
$.post( this.loggerUrl, {url:this.url, action:action, timestamp:date.getTime()} )
where this.url == document.location
$.post -> $.ajax ->
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
and inside jQuery.extend we have line 604:
else if ( copy !== undefined)
target[ name ] = copy;
in this line we have redirect, when target == location and name == "href".
in my own script i'm fix it by replacing
$.post( this.loggerUrl, {url:this.url, action:action, timestamp:date.getTime()} )
to
$.post( this.loggerUrl, {url:this.url.toString(), action:action, timestamp:date.getTime()} )
but how about other users?
i spent one hour before found this feature -)
(sorry for my english)
Attachments (0)
Change History (3)
Changed April 07, 2009 12:34AM UTC by comment:1
Changed April 07, 2009 12:29PM UTC by comment:2
Replying to [comment:1 dmethvin]:
Wow, I'm sure that was a pain to diagnose. I can see why it is happening though. Theurlparameter should be aString: http://docs.jquery.com/Ajax/jQuery.ajax#options However,document.locationis not a string. It's a Location object with properties like.hrefand methods like.toString()https://developer.mozilla.org/en/DOM/document.location If you saidurl: document.location.hrefit should work fine.
Thanx for reply. I'm have fix it as you say.
BUT, I do not think, that this feature is good-) Maybe explicitly convert "key/value pairs" inside
jQuery.extendfunction? Or describe this unexpected behaviour in documentation? with large letters and red color: "DEVELOPER! PLEASE, CONVERT READONLY OBJECTS TO STRING, BEFORE PASS IT TO JQUERY FUNCTIONS" -))
Changed April 10, 2009 11:30PM UTC by comment:3
resolution: | → fixed |
---|---|
status: | new → closed |
I updated the docs to make it clearer.
Wow, I'm sure that was a pain to diagnose. I can see why it is happening though. The
parameter should be a :http://docs.jquery.com/Ajax/jQuery.ajax#options
However,
is not a string. It's a Location object with properties like and methods likehttps://developer.mozilla.org/en/DOM/document.location
If you said
it should work fine.