From 827c8c6b488630d937bfe575db6ff571260fd1c2 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Mon, 22 Oct 2007 01:04:17 +0000 Subject: [PATCH] prototype: Prevent a Firefox bug from throwing errors on page load/unload. Closes #5393, #9421. --- CHANGELOG | 2 ++ src/event.js | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 76b8216..505f8f0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Make sure Event and Event.extend are defined before wrapping events and calling their handler. Prevents a known Firefox bug from throwing errors on page load/unload (cf.: https://bugzilla.mozilla.org/show_bug.cgi?id=361271). Closes #5393, #9421. [staaky, John Resig, sam, Tobie Langel] + * Minor cosmetic changes to the display of unit tests in terminal. [Tobie Langel] * Make submitting forms work in Opera < 9.1. Closes #9917, #9463, #8260. [kangax] diff --git a/src/event.js b/src/event.js index b516b98..b011bea 100644 --- a/src/event.js +++ b/src/event.js @@ -152,8 +152,9 @@ Object.extend(Event, (function() { if (c.pluck("handler").include(handler)) return false; var wrapper = function(event) { - if (event.eventName && event.eventName != eventName) - return false; + if (!Event || !Event.extend || + (event.eventName && event.eventName != eventName)) + return false; Event.extend(event); handler.call(element, event)