Stores jQuery.ajaxSettings.isLocal locally at load time so that any change to it won't affect the transport. Fixes the url parsing regexp to deal with empty domains. Adds informative text into test/localfile.html and handles Opera's failure. Revises the way xhr are created by doing all tests at load time and normalizes all the xhr creation functions so that none of them may throw an exception.
This commit is contained in:
parent
50e950a96e
commit
ee22a59129
3 changed files with 57 additions and 34 deletions
|
@ -25,16 +25,32 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<h1>jQuery Local File Test</h1>
|
||||
<ul>
|
||||
<li>
|
||||
Access this file using the "file:" protocol.
|
||||
</li>
|
||||
<li>
|
||||
Two lines must appear below.
|
||||
</li>
|
||||
<li>
|
||||
Opera will fail at detecting errors, it's a known issue.
|
||||
</li>
|
||||
</ul>
|
||||
<script>
|
||||
jQuery.ajax( "data/badjson.js" , {
|
||||
dataType: "text"
|
||||
}).success(function() {
|
||||
$( "<div/>" ).text( "Success OK" ).appendTo( "body" );
|
||||
});
|
||||
jQuery.ajax( "data/doesnotexist.ext" , {
|
||||
dataType: "text"
|
||||
}).error(function() {
|
||||
$( "<div/>" ).text( "Error OK" ).appendTo( "body" );
|
||||
});
|
||||
jQuery.ajax( "data/badjson.js" , {
|
||||
dataType: "text"
|
||||
}).success(function() {
|
||||
jQuery( "<div/>" ).text( "Success OK" ).appendTo( "body" );
|
||||
});
|
||||
jQuery.ajax( "data/doesnotexist.ext" , {
|
||||
dataType: "text"
|
||||
}).error(function() {
|
||||
jQuery( "<div/>" ).text( "Error OK" ).appendTo( "body" );
|
||||
}).success(function() {
|
||||
if ( jQuery.browser.opera ) {
|
||||
jQuery( "<div/>" ).text( "Error Fail (Opera)" ).appendTo( "body" );
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue