<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Image Tester</title>
<base id="foo" href="file:///does/not/exist/">
<script type="text/javascript" language="javascript">
function stringResult(value, expected) {
var result = eval(value);
var resultString;
if (result == expected)
resultString = "SUCCESS";
else
resultString = "FAILURE";
return "<strong>" + resultString + "<\/strong> (" + value + " = " + result + ")";
}
function init() {
if (window.testRunner)
testRunner.dumpAsText();
document.images["test"].longDesc = "test-description.html";
var beforeDiv = document.getElementById("before");
beforeDiv.innerHTML = stringResult("document.images[0].longDesc", "file:///does/not/exist/test-description.html");
document.getElementById("foo").setAttribute("href", "file:///also/does/not/exist/");
var afterDiv = document.getElementById("after");
afterDiv.innerHTML = stringResult("document.images[0].longDesc", "file:///also/does/not/exist/test-description.html");
}
</script>
</head>
<body onLoad="init()">
<p>
The image object.longDesc is expected to be the full path to the image description, relative to the document base.<br>
To match WinIE (but not FireFox), we resolve the image path in the getter, rather than the setter, allowing for pages to change the Document base URL via javascript and have object.longDesc reflect said change.
</p>
<img id="test" name="test" longdesc="" style="display: none">
<div style="font-size:small" id="before"></div>
<p>After changing the base URL:</p>
<div style="font-size:small" id="after"></div>
</body>
</html>