95 lines
2.9 KiB
HTML
95 lines
2.9 KiB
HTML
<head>
|
|
<base href="file:///BASE/">
|
|
<style>
|
|
|
|
table { border-spacing: 0; border-collapse: collapse; border: 1px solid #999; }
|
|
thead { font: x-small 'Lucida Grande'; }
|
|
thead > tr { background-color: #dee; border-bottom: 1px solid #999; }
|
|
td, th { padding: 4px; border-width: 0 1px; border-style: solid; border-color: #999 }
|
|
tbody { font: small monospace; }
|
|
tbody > tr:nth-child(odd) { background-color: #eee; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<p>
|
|
The following table shows how URLs are parsed and canonicalized. The base URI
|
|
for this document is <tt>file:///BASE/</tt>.
|
|
</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>URL</th>
|
|
<th>href</th>
|
|
<th>host</th>
|
|
<th>pathname</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id = "results"></tbody>
|
|
</table>
|
|
<script>
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
|
|
function test(url)
|
|
{
|
|
var anchor = document.createElement("a");
|
|
anchor.href = url;
|
|
|
|
var row = document.getElementById("results").appendChild(document.createElement("tr"));
|
|
row.appendChild(document.createElement("td")).appendChild(anchor).appendChild(document.createTextNode(url));
|
|
row.appendChild(document.createElement("td")).appendChild(document.createTextNode(anchor.href));
|
|
row.appendChild(document.createElement("td")).appendChild(document.createTextNode(anchor.host));
|
|
row.appendChild(document.createElement("td")).appendChild(document.createTextNode(anchor.pathname));
|
|
}
|
|
|
|
var testCases = [
|
|
"",
|
|
"test",
|
|
"/",
|
|
"/test",
|
|
"//",
|
|
"//test",
|
|
"///",
|
|
"///test",
|
|
"file:",
|
|
"file:test",
|
|
"file:/",
|
|
"file:/test",
|
|
"file://",
|
|
"file://test",
|
|
"file:///",
|
|
"file:///test",
|
|
"file://localhost",
|
|
"file://localhost/",
|
|
"file://localhost/test",
|
|
"http:",
|
|
"http:/",
|
|
"http://",
|
|
"http:///",
|
|
"http:////",
|
|
"http:webkit.org",
|
|
"http:/webkit.org",
|
|
"http://webkit.org",
|
|
"http:///webkit.org",
|
|
"http:////webkit.org",
|
|
"http://///webkit.org",
|
|
"http://////webkit.org",
|
|
"http:////////////////webkit.org",
|
|
"http://localhost",
|
|
"http://localhost/",
|
|
"http://localhost/test",
|
|
"x-webkit:",
|
|
"x-webkit:test",
|
|
"x-webkit:/",
|
|
"x-webkit:/test",
|
|
"x-webkit://",
|
|
"x-webkit://test",
|
|
"x-webkit:///",
|
|
"x-webkit:///test",
|
|
];
|
|
|
|
for (var i = 0; i < testCases.length; ++i)
|
|
test(testCases[i]);
|
|
</script>
|
|
</body>
|