<p>This test checks for a particular problem in WebKit internals where adding the same function
first as a non-HTML and then as an HTML event listener could leave the "is HTML" flag set wrong.</p>

<p>If the test succeeds, you should see the word SUCCESS below. Otherwise, you'll see the word FAILURE or nothing at all.</p>

<p id="result"></p>

<a href="javascript:void(document.getElementById('result').innerHTML = 'FAILURE')" id="anchor">test anchor - script clicks this automatically</a>

<script>

if (window.testRunner)
    testRunner.dumpAsText();

function listener(event)
{
    document.getElementById('result').innerHTML = 'SUCCESS';
    return false;
}

var anchor = document.getElementById("anchor");

anchor.addEventListener("click", listener, false);
anchor.onclick = listener;

var clickEvent = document.createEvent("MouseEvents");
clickEvent.initMouseEvent("click", true, true, null, 1, 1, 1, 1, 1, false, false, false, false, 0, document);
anchor.dispatchEvent(clickEvent);

</script>
