W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2011

onclick after removing element from document during onmouseup

From: Glenn Maynard <glenn@zewt.org>
Date: Sun, 27 Feb 2011 04:40:52 -0500
Message-ID: <AANLkTikNHi+LsrzQfEMPa-mLL1ejyp7o75ZXKou75ew7@mail.gmail.com>
To: www-dom@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:07 GMT