<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Image map bug</title>
<script type="text/javascript">
if (window.testRunner)
testRunner.dumpAsText();
function changeMap() {
var i = document.getElementById('img');
var h = document.getElementById('mapHolder');
i.useMap = '';
h.innerHTML = '<map name="map"><area shape="rect" coords="0,0,300,200" alt="" href="javascript:success()"></map>';
i.useMap = '#map';
}
function success() {
document.getElementById("log").innerHTML = "SUCCESS";
}
function fail() {
document.getElementById("log").innerHTML = "FAIL";
}
</script>
</head>
<body>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=9504">bug 9504</a>: img tag rewritten by innerHTML doesn't use image map.</p>
<div id=log>Testing...</div>
<div>
<img id="img" width="300" height="200" usemap="#map" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAxJREFUCNdjYKhnAAABAgCAbV7tZwAAAABJRU5ErkJggg=="/>
</div>
<div id="mapHolder"><map name="map"><area shape="rect" coords="0,0,300,200" alt="" title="First" href="javascript:fail()"></map></div>
<script>
changeMap();
if (window.eventSender) {
eventSender.mouseMoveTo(100, 100);
eventSender.mouseDown();
eventSender.mouseUp();
} else
document.getElementById("log").innerHTML = "Please click the image";
</script>
</body>
</html>