Merge branch 'fix-8456-lost-mouseenter' of https://github.com/dmethvin/jquery into...
[jquery.git] / test / localfile.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
3 <head>
4         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5         <title>jQuery Local File Test</title>
6         <!-- Includes -->
7         <script src="../src/core.js"></script>
8         <script src="../src/deferred.js"></script>
9         <script src="../src/support.js"></script>
10         <script src="../src/data.js"></script>
11         <script src="../src/queue.js"></script>
12         <script src="../src/attributes.js"></script>
13         <script src="../src/event.js"></script>
14         <script src="../src/sizzle/sizzle.js"></script>
15         <script src="../src/sizzle-jquery.js"></script>
16         <script src="../src/traversing.js"></script>
17         <script src="../src/manipulation.js"></script>
18         <script src="../src/css.js"></script>
19         <script src="../src/ajax.js"></script>
20         <script src="../src/ajax/jsonp.js"></script>
21         <script src="../src/ajax/script.js"></script>
22         <script src="../src/ajax/xhr.js"></script>
23         <script src="../src/effects.js"></script>
24         <script src="../src/offset.js"></script>
25         <script src="../src/dimensions.js"></script>
26         <style>
27                 .error { color: red; }
28                 .success { color: green; }
29         </style>
30 </head>
31 <body>
32         <h1>jQuery Local File Test</h1>
33         <h2>
34                 Introduction
35         </h2>
36         <ul>
37                 <li>
38                         Access this file using the "file:" protocol,
39                 </li>
40                 <li>
41                         two green "OK" strings must appear below,
42                 </li>
43                 <li>
44                         Empty local files will issue errors, it's a known limitation.
45                 </li>
46         </ul>
47         <h2>
48                 Results
49         </h2>
50         <ul>
51                 <li>
52                         Success:
53                         <span id="success">
54                         </span>
55                 </li>
56                 <li>
57                         Error:
58                         <span id="error">
59                         </span>
60                 </li>
61         </ul>
62         <h2>
63                 Logs:
64         </h2>
65         <ul id="log">
66         </ul>
67         <script>
68                 var logUL = jQuery( "#log" );
69                 function doLog( message, args ) {
70                         jQuery( "<li />").appendTo( logUL ).text( message + ': "' + Array.prototype.join.call( args, '" - "' ) + '"' );
71                 }
72                 jQuery.ajax( "./data/badjson.js" , {
73                         context: jQuery( "#success" ),
74                         dataType: "text"
75                 }).success(function( data, _, xhr ) {
76                         doLog( "Success (" + xhr.status + ")" , arguments );
77                         this.addClass( data ? "success" : "error" ).text( "OK" );
78                 }).error(function( xhr ) {
79                         doLog( "Success (" + xhr.status + ")" , arguments );
80                         this.addClass( "error" ).text( "FAIL" );
81                 });
82                 jQuery.ajax( "./data/doesnotexist.ext" , {
83                         context: jQuery( "#error" ),
84                         dataType: "text"
85                 }).error(function( xhr ) {
86                         doLog( "Error (" + xhr.status + ")" , arguments );
87                         this.addClass( "success" ).text( "OK" );
88                 }).success(function( data, _, xhr ) {
89                         doLog( "Error (" + xhr.status + ")" , arguments );
90                         this.addClass( "error" ).text( "FAIL" );
91                 });
92         </script>
93 </body>