Make a new jQuery.support.noCloneChecked - splitting apart the previous feature detec...
[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/support.js"></script>
9         <script src="../src/data.js"></script>
10         <script src="../src/queue.js"></script>
11         <script src="../src/attributes.js"></script>
12         <script src="../src/event.js"></script>
13         <script src="../src/sizzle/sizzle.js"></script>
14         <script src="../src/sizzle-jquery.js"></script>
15         <script src="../src/traversing.js"></script>
16         <script src="../src/manipulation.js"></script>
17         <script src="../src/css.js"></script>
18         <script src="../src/ajax.js"></script>
19         <script src="../src/ajax/jsonp.js"></script>
20         <script src="../src/ajax/script.js"></script>
21         <script src="../src/ajax/xhr.js"></script>
22         <script src="../src/effects.js"></script>
23         <script src="../src/offset.js"></script>
24         <script src="../src/dimensions.js"></script>
25         <style>
26                 .error { color: red; }
27                 .success { color: green; }
28         </style>
29 </head>
30 <body>
31         <h1>jQuery Local File Test</h1>
32         <h2>
33                 Introduction
34         </h2>
35         <ul>
36                 <li>
37                         Access this file using the "file:" protocol,
38                 </li>
39                 <li>
40                         two green "OK" strings must appear below,
41                 </li>
42                 <li>
43                         Empty local files will issue errors, it's a known limitation.
44                 </li>
45         </ul>
46         <h2>
47                 Results
48         </h2>
49         <ul>
50                 <li>
51                         Success:
52                         <span id="success">
53                         </span>
54                 </li>
55                 <li>
56                         Error:
57                         <span id="error">
58                         </span>
59                 </li>
60         </ul>
61         <h2>
62                 Logs:
63         </h2>
64         <ul id="log">
65         </ul>
66         <script>
67                 var logUL = jQuery( "#log" );
68                 function doLog( message, args ) {
69                         jQuery( "<li />").appendTo( logUL ).text( message + ': "' + Array.prototype.join.call( args, '" - "' ) + '"' );
70                 }
71                 jQuery.ajax( "./data/badjson.js" , {
72                         context: jQuery( "#success" ),
73                         dataType: "text"
74                 }).success(function( data, _, xhr ) {
75                         doLog( "Success (" + xhr.status + ")" , arguments );
76                         this.addClass( data ? "success" : "error" ).text( "OK" );
77                 }).error(function( xhr ) {
78                         doLog( "Success (" + xhr.status + ")" , arguments );
79                         this.addClass( "error" ).text( "FAIL" );
80                 });
81                 jQuery.ajax( "./data/doesnotexist.ext" , {
82                         context: jQuery( "#error" ),
83                         dataType: "text"
84                 }).error(function( xhr ) {
85                         doLog( "Error (" + xhr.status + ")" , arguments );
86                         this.addClass( "success" ).text( "OK" );
87                 }).success(function( data, _, xhr ) {
88                         doLog( "Error (" + xhr.status + ")" , arguments );
89                         this.addClass( "error" ).text( "FAIL" );
90                 });
91         </script>
92 </body>