onclick after removing element from document during onmouseup

If an element is removed from the document during mouseup, should the click
event still fire?

Example below.  In FF3/4, when the link is clicked, no click event is
dispatched and the link doesn't activate.  In Chrome 9, the click event
still fires.  (This doesn't happen with keydown/keypress; for that event
sequence, both browsers match FF.)

I think Gecko's behavior makes more sense.  I can't find this in the
spec--is this covered?


<a href="http://www.google.com" id="test">test</a>
<script>
var elem = document.getElementById("test");
elem.addEventListener("mouseup", function(e) {
        elem.parentNode.removeChild(elem);
}, false);
</script>

-- 
Glenn Maynard

Received on Sunday, 27 February 2011 09:41:27 UTC