About Events Capturing

Dusting Diaz blogs about consuming events in Mozilla.
I’ve always enjoyed his postings but I have to disagree about having to wait for a ‘better’ IE: the same tricks can already be performed in current version of IE.

Simply react to a click event with this code (pasted from nextBBS’ common.php):

?View Code JAVASCRIPT
// A very experimental private function: consume the original event, if possiblefunction _killEvent(e)
{
    if(e.preventDefault)
    {
        e.preventDefault()
        e.stopPropagation();
    }
    else
    {
        e.cancelBubble = true;
        e.returnValue = false;
    }
}

Similar Posts:

If you enjoyed this post, make sure you subscribe to my RSS feed!

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

Hi, I’m afraid this is a bit off-topic, I tried to find your mail address but the contact page appears to be the home page. I tried to leave the comment on the sIFR post, but the page comes up blank. So…

Thanks for making that tool :) One suggestion I’d make is to support those character set selections from Flash itself. Did you look into supporting sIFR 3? I have to say I haven’t really tried yet.

You may have missed the point in this post. This CANNOT be performed in IE. Event capturing is “different” than event bubbling. The preventDefault and stopPropgation in one sense had little to do with the point of the post.

Take special note of the boolean passed into the addEventListener’s third argument.

Leave a comment

(required)

(required)