LayoutTests:
[WebKit-https.git] / LayoutTests / fast / dom / javascript-backslash.html
1 <html>
2     <head>
3         <script type="text/javascript">
4             function log(message)
5             {
6                 var item = document.createElement("li");
7                 item.appendChild(document.createTextNode(message));
8                 document.getElementById("console").appendChild(item);
9             }
10             function test()
11             {
12                 if (window.layoutTestController)
13                     layoutTestController.dumpAsText();
14                 log("javascript: function argument containing a backslash (\\) should not be converted to a slash (/): \"" + document.getElementById("1").pathname + "\"");
15                 log("http: base should convert a \\ to a / : \"" + document.getElementById("2").href + "\"");
16                 log("https: base should also convert a \\ to a / : \"" + document.getElementById("3").href + "\"");
17                 log("file: base should convert a \\ to a / : \"" + document.getElementById("4").href + "\"");
18                 log("any other valid base except javascript: should convert a \\ to a / : \"" + document.getElementById("5").href + "\"");
19                 log("query strings should be left alone: \"" + document.getElementById("6").href + "\"");
20                 log("anchors should be left alone as well: \"" + document.getElementById("7").href + "\"");
21             }
22         </script>
23     </head>
24     <body onload="test()">
25         <p>This tests \ characters being changed to / in all different scenarios.</p>
26         <p>If it works you should see seven messages below that have \ or / characters as specified.</p>
27         <hr>
28         <a id="1" href="javascript:alert('to be\\not')">1</a>
29         <a id="2" href="http://apple.com\support">2</a>
30         <a id="3" href="https:\\login.apple.com\support/">3</a>
31         <a id="4" href="file:///Users\">4</a>
32         <a id="5" href="ftp://apple.com\support/">5</a>
33         <a id="6" href="http://apple.com\support?path=\\myshare\myfolder\myfile\">6</a>
34         <a id="7" href="http://apple.com\support#path=\\myshare\myfolder\myfile\">7</a>
35         <hr>
36         <p><ol id="console"></ol></p>
37     </body>
38 </html>