jQuery's Missing Function, cancelEvent, part 2

Alright, a couple of posts ago, I wrote about jQuery's missing function, what I call cancelEvent. It is a combination of preventDefault() and stopPropagation(). I use it quite a bit at Ubernote for a whole slew of things, but have realized that my approach of editing the source works great, if you are serving the source up yourself. For those that are serving their jQuery from Google API, this does not work so well. We can't just ask Google to change jQuery for us, and since this is not a W3C function, the chances of it ever making it into jQuery are slim to none. So, we have to do it ourselves.

In the web page where you include Google API's jQuery via a direct call to the library:


<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>

<script type='text/javascript'>
jQuery.Event.prototype.cancelEvent = function(){
       this.preventDefault(); this.stopPropagation();
};
</script>

I have not tested this with using the google.load("jquery", "1.3.2") method yet, this may not work depending on how Google creates the script element for jQuery. I'll let you know when I do test it.