git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
jquery core: closes #2652. val() supports option elements, also simplified the code.
[jquery.git]
/
src
/
ajax.js
diff --git
a/src/ajax.js
b/src/ajax.js
index
dbe731b
..
853bcbb
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-236,12
+236,13
@@
jQuery.extend({
jQuery.event.trigger( "ajaxStart" );
// Matches an absolute URL, and saves the domain
jQuery.event.trigger( "ajaxStart" );
// Matches an absolute URL, and saves the domain
- var remote = /^(?:\w+:)?\/\/([^\/?#]+)/;
+ var parts = /^(\w+:)?\/\/([^\/?#]+)/.exec( s.url );
// If we're requesting a remote document
// and trying to load JSON or Script with a GET
// If we're requesting a remote document
// and trying to load JSON or Script with a GET
- if ( s.dataType == "script" && type == "GET"
- && remote.test(s.url) && remote.exec(s.url)[1] != location.host ){
+ if ( s.dataType == "script" && type == "GET" && parts
+ && ( parts[1] && parts[1] != location.protocol || parts[2] != location.host )){
+
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = s.url;
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = s.url;
@@
-469,7
+470,8
@@
jQuery.extend({
throw "parsererror";
// Allow a pre-filtering function to sanitize the response
throw "parsererror";
// Allow a pre-filtering function to sanitize the response
- if( s.dataFilter )
+ // s != null is checked to keep backwards compatibility
+ if( s && s.dataFilter )
data = s.dataFilter( data, type );
// If the type is "script", eval it in global context
data = s.dataFilter( data, type );
// If the type is "script", eval it in global context